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 with a wildcard match now.  */
>> +	sscanf(value, "refs/%*[^/]/*:%nrefs/remotes/%*[^/]/*%n",
>> +	       &len_first, &len_second);
>> +	if (len_first != -1 && len_second != -1
>> +	    && (len_second - 2) - len_first == remote_len + 13
>> +	    && !strncmp(value + len_first, start_ref, remote_len + 13)) {
>> +		/* Replace the star with the remote branch name.  */
>> +		asprintf(&config_repo, "%.*s%s",
>> +			 len_first - 3, value,
>> +			 start_ref + remote_len + 13);
> 
> Same here:
> 
> 	else if (!prefixcmp(value, "refs/") && (p = strchr(value, ':')) &&
> 			!memcmp(p + 1, start_ref, remote_len) &&
> 			!strcmp(p + 1 + remote_len, "/*")) {
> 		config_repo = xstrdup(value);
> 		config_repo[p - value] = '\0';
> 	}

This is not what my code does.  Are you saying that yours is correct, or that it should actually be the same in practice, or just that I should avoid sscanf/asprintf (which I won't do, since I got mildly insane after writing half of the function without sscanf -- and then decided that the C library is there to be used).

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]