Fixing Outdated Docs in Git: My First Contribution
Contributing to Git for GSoC seemed like a good goal, given my experience with related technologies and daily use of Git itself. As a first step, I decided to examine the documentation, starting with the guide aimed at new contributors: MyFirstContribution.adoc
.
Spotting Discrepancies
While reading the guide and attempting to follow its examples, I encountered several inconsistencies. Some code snippets didn't compile against the current Git source, and certain instructions referred to outdated practices or interfaces. It seemed the document hadn't fully kept pace with the codebase evolution.
Since the GSoC program suggests starting with a small "microproject," updating this document felt like a suitable task. I sent an initial query to the Git mailing list to gauge if this was a reasonable approach:
"Hey Git community, I'm Jay... I'm pretty new to open source... I went through the documentation... and found that there were several outdated elements and issues... I wanted to ask for advice if updating MyFirstContribution.adoc would be a good micro project or am I looking in the wrong way?"
- My initial query (March 8)The responses provided useful context. Mahendra Dani shared links to the official microproject list and other relevant resources, which was helpful for orientation.
Junio Hamano, the Git maintainer, also replied, offering clarification on the purpose and nature of microprojects within the Git community:
"All good suggestions, but we also welcome students who try to scratch their own itch, as long as it is small enough..."
"The primary objective for a micro-project is to get used to the workflow, i.e. working with the community mainly via this mailing list, how you explain your changes... how to work with those who gave you reviews..."
"...you do not need to ask for permission to start working on anything around here. 'Am I allowed to do X for my microproject' is not the question you want to ask; rather 'I see document X says A, B, and C, but A is outdated and I think it is better to phrase it like D. Would it be a suitable microproject material?' is something we can work with."
"To solicit such productive reaction from others, you'd need to be a bit more specific than 'I see flaws and want to improve'."
- Junio C Hamano (March 8)This feedback was instructive. It highlighted that the key wasn't seeking permission but rather identifying specific issues and proposing concrete fixes. It also emphasized that the microproject phase is primarily about learning the contribution process – communication via the mailing list, patch formatting, handling reviews – rather than just the technical change itself. The main takeaway was the need for specificity when discussing potential changes.
Getting Specific
Following that advice, I re-examined MyFirstContribution.adoc
and the related code, carefully documenting the specific problems I'd found:
-
Outdated Function Signature:
The documentation showed the example
cmd_psuh
function with this signature:int cmd_psuh(int argc, const char **argv, const char *prefix);
However, the current definition in
builtin.h
includes an additionalstruct repository *repo
parameter:int cmd_psuh(int argc, const char **argv, const char *prefix, struct repository *repo);
This difference caused compilation errors when following the guide directly.
-
Missing `UNUSED` Macro Information:
The tutorial's code example didn't utilize all parameters passed to the function (e.g.,
argc
,argv
). This typically generates compiler warnings about unused parameters. The standard Git practice involves using theUNUSED
macro (likeUNUSED(argv);
) to explicitly mark parameters as intentionally unused, but the guide didn't mention this technique. -
Incorrect Config Function Reference:
The guide's "Implementation" section suggested using
git_config(...)
for handling configuration. In practice, particularly with the updated function signature requiring therepo
struct, usingrepo_config(...)
was necessary. Whilegit_config
exists as a wrapper, directly usingrepo_config
seemed simpler and more appropriate for the tutorial's context.(Note: I initially overlooked that `git_config` acts as a wrapper, but `repo_config` still appeared more direct for this specific example.)
-
Stale External Link:
The document linked to an external GitHub repository (
nasamuffin/git/tree/psuh
) intended as a complete reference implementation. This repository hadn't been updated recently and didn't align with current Git source code (e.g., the function signature change), causing confusion during comparison.
I outlined these points and the proposed fixes in a detailed follow-up email to the mailing list:
"Got it, I’ll focus on being specific... Here’s what I found in 'MyFirstContribution.adoc'...
1. Outdated Function Signature... Proposed Fix: Update the signature...
2. Unused Parameters Handling Not Documented... Proposed Fix: Add a note... use the UNUSED macro...
3. Incorrect Config Function Reference... mentions git_config(...), but... I had to use repo_config(...)... Proposed Fix: Update the doc to use repo_config(...)...
4. Outdated Reference Link... Proposed Fix: Update the link... or clarify its status.
I seek feedback as to if this mail is well specified..."
Confirmation and Additional Pointers
This specific approach received positive confirmation. Karthik Nayak responded, agreeing with the assessment of the issues:
"Yes, this [function signature update] would be nice for users who try to follow the guide."
"This [UNUSED macro note] seems worthwhile too!"
"I think for new commands and also for new users, it is not worthwhile to get into how the `USE_THE_REPOSITORY_VARIABLE` macro works. So I think it'd be best to modify the documentation to use 'repo_config()' as you suggested here."
Regarding the external link: "This is a bit hard... easiest way... would be to raise a PR to Emily's repository..."
"I also see some more potential fixes... Remove git-mentoring@googlegroups.com... Rename 'Documentation/git-psuh.txt' -> 'Documentation/git-psuh.adoc'."
"I think the changes you suggested would be great to have. Looking forward to the patche[s]... Thanks for fixing documentation, it is very important to keep them updated!"
- Karthik Nayak (March 10)This response confirmed that the identified issues were valid points for improvement. Karthik also provided practical advice on handling the external link and suggested two additional minor cleanups related to the documentation.
Preparing for the Patch
With the problems clearly defined, proposed solutions discussed, and confirmation received from the community, the next step was concrete: preparing the actual changes. This involved modifying the documentation file, formatting the changes as a patch, writing a clear commit message, and submitting it via the mailing list for review – the practical application of the workflow I was here to learn.