Às 22:36 de 26-05-2016, Junio C Hamano escreveu:
> Vasco Almeida <vascomalme...@sapo.pt> writes:
>
>> @@ -222,9 +223,10 @@ has_action () {
>> }
>>
>> is_empty_commit() {
>> - tree=$(git rev-parse -q --verify "$1"^{tree} 2>/dev/null ||
>> - die "$1: not a commit that can be picked")
>> - ptree=$(git rev-parse -q --verify "$1"^^{tree} 2>/dev/null ||
>> + sha1=$1
>> + tree=$(git rev-parse -q --verify "$sha1"^{tree} 2>/dev/null ||
>> + die "$(eval_gettext "\$sha1: not a commit that can be picked")")
>> + ptree=$(git rev-parse -q --verify "$sha1"^^{tree} 2>/dev/null ||
>> ptree=4b825dc642cb6eb9a060e54bf8d69288fbee4904)
>> test "$tree" = "$ptree"
>> }
>
> Both of the two callsites of this function use the variable $sha1,
> and at least one of them uses that variable after this function
> returns, but they pass it as the first parameter to this function,
> so the assignment added by this patch does not break them, which is
> good.
>
I didn't know that. I can change sha1=$1 to local_sha1=$1 or _sha1=$1 (I
don't know what is the convention here) if that is safer, avoiding using
the bash-ism "local" keyword, and preventing future distractions.
--
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