On 06/16/2014 10:43 PM, Jeff King wrote:
>> + v = git_config_get_string(alias_key);
>> + if (!v)
>> + config_error_nonbool(alias_key);
> What does a NULL output from git_config_get_string mean? I think with
> the current code, it means "no such key was found". In which case, you
> should be returning NULL here (there is no such alias), not complaining
> with config_error_nonbool.
Yes, you surmised correctly. I totally skipped the fact that git_config() can
return null for values indicating a boolean value. I will correct it in the next
> Again, this is going to depend on your strategy for storing booleans
> that I mentioned elsewhere.
I have read your other two replies related to it. I suggest the following
for git_config_get_string(), it will return,
1. Return null if no value was found for the entered key.
2. Empty string (""), returned for NULL values denoting boolean true in some
I think it would be much better than converting NULL to "true" or something
internally in the function.
We can easily handle such cases as the above with a strcmp like,
+ v = git_config_get_string(alias_key);
+ if (!strcmp(v, ""))
What do you think about this approach?
Thanks for the suggestion, I was pulling my hair out due this bug for last two
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html