From Git SCM Wiki
Revision as of 12:21, 9 March 2013 by PeterMortensen (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Here are some simple but useful cleanup tasks that can be done on the Git source code.

While it was suggested that this would be a very good way to get started if you want to start working on Git or learning its internals, it turns out that usually, the tasks are not interesting enough, and there is a lot of resistance to let the patches go in. So it is better to start scratching an itch if you have one.

In any case, please be sure to read the SubmittingPatches document before posting your patches. Also please check that your patches apply by sending them to yourself first and then by using "git apply" on what you received.

Also note that it may happen that this list is not up to date. In this case please send an email to the Git mailing list (git@vger.kernel.org). Bonus point if you propose to fix that yourself on the wiki!

  • Refactor binary search functions
    • There are different binary search functions in the Git code base. Some are quite complex like in "sha1-lookup.c", and others are simpler.
    • A refactoring has been started. So now the "sha1_pos" function from "sha1-lookup.{h,c}" is used in some places.
    • It would be a good idea to use "sha1_pos" in more places. Look for "*_pos" (and perhaps "lookup_*") functions.
    • See this patch for an example of how it can be done.
  • Improve header file include directives (Please don't do that right now as there are some discussions about this on the mailing list these days and things are still in flux.)
    • Some Git headers depend on other headers to compile cleanly, in this case it might be a good idea to include the needed headers in the header that needs them.
    • For example "revision.h" depends on "commit.h" and "diff.h", so "revision.h" should include them.
    • Of course after that it makes sense to clean up the "*.c" source files that include all these headers, to remove the headers that are no more needed there.
    • There may be other ways to cleanup header file include directives.
  • Convert code to use "-q" option where appropriate
    • Many Git commands have some "-q" or "--quiet" option to make them "quiet".
    • There are many uses of ">/dev/null" or "2>/dev/null" with these commands, written before "-q" existed.
    • Some of these plases can be converted to use "-q" without changing the semantics.
  • Use time_t for timestamps returned by approxidate() instead of unsigned long. This also affects e.g. OPT_DATE options.
  • Contact the mail list to see how to proceed.

Personal tools