Re: [PATCH 1/3] git-branch: add --track and --no-track options

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



>> +	/* Try an exact match first.  */
>> +	sscanf(value, "refs/%*[^:]:%n", &len_first);
> 
> This is the first time I saw that sscanf format type. How portable is it?

It is.  At the very least it is in OpenGroup.

>> +		/* Truncate the value before the colon.  */
>> +		asprintf(&config_repo, "%.*s", len_first - 1, value);
> 
> asprintf() is a GNU extension. I guess it is better to just
> 
> 	config_repo = xstrdup(value);
> 	config_repo[p - value] = '\0';

git has nfvasprintf -- I'll just use that one.

> FWIW I don't think .trackIntoLocalBranches" is needed. Opinions?

That's because I'd like to make it the default for me...  Also, look at patch 3/3.

>> @@ -333,7 +424,9 @@ static void create_branch(const char *name, const char *start_name,
>>  	if (start_sha1)
>>  		/* detached HEAD */
>>  		hashcpy(sha1, start_sha1);
>> -	else if (get_sha1(start_name, sha1))
>> +	else if (dwim_ref(start_name, strlen(start_name), sha1, &real_ref) > 1)
>> +		die("Ambiguous object name: '%s'.", start_name);
> 
> I know, I should have said that earlier, but I just found out myself: We 
> have a config variable core.warnambiguousrefs, and maybe we should _not_ 
> complain and set the defaults when the global variable warn_ambiguous_refs 
> is 0.

If warn_ambiguous_ref == 0, dwim_ref is never going to answer anything > 1...

Paolo
-
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

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]