Re: [PATCH] commit: check return value of lookup_commit()

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

 



On Wed, Aug 17, 2011 at 1:02 AM, Junio C Hamano >> But then I would
need to avoid die()ing in "initial_commit" case.
>
> That's exactly what I said.
>
>        if (!initial)
>                /* we need to know the head_commit */
>                head_commit = lookup_and_check(HEAD);
>
>        /* depending on what kind of commit, we need different stuff */
>        if (initial)
>                ... going to create a parentless commit
>        else if (amending)
>                ... use the head_commit to learn parent, reuse the message
>                ... from there
>        else if ...
>
> These two are independent if/else cascades in the sense that the first is
> about learning the details of head_commit, and the latter is about
> learning how the commit is done, and in a subset of the latter head_commit
> is used.

And some months from now, someone may add more code in between the two
"if" blocks. Some more months past, someone tweaks the "if (initial)"
block but forgets to also update the "if (!initial)" above. This is
what I want to avoid.
-- 
Duy
--
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]