Re: What's cooking in git.git (Jun 2011, #02; Sat, 11)

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

 



Ramkumar Ramachandra <artagnon@xxxxxxxxx> writes:

> Have you seen my "libify reset" patch [1]?  I thought it was an easy candidate.

The reset-index-file part might be (but I agree with Jonathan that we can
wait until we need it), but the other one does not deserve to be called a
"libified" function if you look at it as an API function.

There are many places we show abbreviated commit object name and its title
with different frills around that message, but that particular function
does not help them unless the other callers want the same "HEAD is now at"
frill. Try this:

 $ git checkout HEAD^
 HEAD is now at 2cbd969... Git 1.7.6-rc1
 $ git checkout master
 Previous HEAD position was 2cbd969... Git 1.7.6-rc1
 Switched to branch 'master'

Your helper cannot even help produce "Previous HEAD position was", even
though I am reasonably sure they share the same logic. 

A helper whose signature is something like

    void pretty_print_commit(FILE *f, const char *fmt, struct commit *commit);

so that the caller can say

    pretty_print_commit(stdout, "HEAD is now at %h... %s\n", commit)

instead of "print_new_head(commit)", might be a good addition to the
"libified" helper set, but I suspect it is not worth it.

Look at how clearly and succinctly describe_detached_head() is implemented
in builtin/checkout.c

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