repository: move fetch_if_missing into struct repository#11
Conversation
|
I'm very unconvinced about the changes in this patch, although they are so simple and might be correct formally. The reason is that I am still trying to figure out the mechanism of partial clone and promise remote (that's why I haven't explained what fetch_if_missing does in detail ); |
In other words, repository seems to be the least bad place to go. Because |
53fa807 to
26551f9
Compare
The global variable 'fetch_if_missing' controls whether a missing object check should prompt a lazy fetch from a promisor remote. In order to continue the libification effort, move it into 'struct repository' and initialize it to 1 by default to keep the previous behavior. Subsystems that already pass around a repository pointer, are updated to read this flag directly from their respective 'repo' instances. For the rest, we access 'the_repository'. Note that in builtin/fsck.c and builtin/index-pack.c, when running related commands with the '-h' parameter, the 'repo' pointer is not passed in. To prevent null pointer dereferences, we defer operations on the repo in until after parameter parsing is complete. Additionally, update the partial clone documentation to reflect that this is now a per-repository flag. Mentored-by: Christian Couder <christian.couder@gmail.com> Mentored-by: Ayush Chandekar <ayu.chandekar@gmail.com> Mentored-by: Olamide Caleb Bello <belkid98@gmail.com> Signed-off-by: Tian Yuchen <cat@malon.dev>
26551f9 to
d236f48
Compare
The global variable 'fetch_if_missing' controls whether a missing object check should prompt a lazy fetch from a promisor remote. In order to continue the libification effort, Move it into 'struct repository' and initialize it to 1 by default to keep the previous behavior.
Subsystems that already pass around a repository pointer, are updated to read this flag directly from their respective 'repo' instances. Builtin commands are updated to modify
'the_repository->fetch_if_missing'. Where necessary, the 'USE_THE_REPOSITORY_VARIABLE' macro is defined to allow these commands to access 'the_repository'.
Additionally, update the partial clone documentation to reflect that this is now a per-repository flag.
Mentored-by: Christian Couder christian.couder@gmail.com
Mentored-by: Ayush Chandekar ayu.chandekar@gmail.com
Mentored-by: Olamide Caleb Bello belkid98@gmail.com