Alex Riesen <raa.lkml@xxxxxxxxx> writes: > Strip trailing spaces off guessed target directory in builtin clone, > and replace 'control' characters with an ASCII space. > > User still can have any name by specifying it explicitely after url. > > Signed-off-by: Alex Riesen <raa.lkml@xxxxxxxxx> > --- > > This should take care of accidental pastings inside shell quotes. > At least for the local part of the operation. > Now I'm looking at the code and think I should have stripped the > heading whitespace as well. It is much less likely to happen, though. > @@ -140,10 +141,21 @@ static char *guess_dir_name(const char *repo, int is_bundle, int is_bare) > if (is_bare) { > struct strbuf result = STRBUF_INIT; > strbuf_addf(&result, "%.*s.git", (int)(end - start), start); > + dir = strbuf_detach(&result, 0); > + } else > + dir = xstrndup(start, end - start); > + /* replace all 'control' characters with ascii space */ > + for (start = dir; *start; ++start) > + if (*(const unsigned char *)start < 32u) > + dir[start - dir] = '\x20'; What's this strange mixture of 32u and '\x20'? > + /* remove trailing spaces */ > + if (dir < start) > + for (end = start; dir < --end; ) > + if (!isspace(*end)) > + break; > + else > + dir[end - dir] = '\0'; > + return dir; > } Honestly, I regret having asked if there was a 2/2 ;-) What's the point of this change, now that you have a fix in 1/2? Who are you helping with this patch? -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html