{"push_id":2447917545,"size":18,"distinct_size":18,"ref":"refs/heads/setup-git-dir-cleanup","head":"94ccd61815abd278007923386a7281fcd24f32c2","before":"fc3a19303d259955bd300535371140aca4a3d22c","commits":[{"sha":"3f95d2b772998da0361d270e079887647473c4ca","author":{"name":"Nguyễn Thái Ngọc Duy","email":"d0e3b15a74ff6c70e81434a55b9c843230dc3715@gmail.com"},"message":"setup.c: initialize repo algo correctly in all cases\n\nThere are many ways for any command to access a git repository:\n\n- most of them will try to discover the .git dir via\n  setup_git_directory() and friends\n\n- the server side programs already know where the repo is and prepare\n  with enter_repo()\n\n- special commands that deal with repo creation (init/clone) use\n  init_db() once the new repo is ready for access.\n\n- somebody accesses $GIT_DIR before any of above functions are called\n  and accidentally sets up a git repository by set_git_dir() alone\n\n\"the_repository\" is partially set up via set_git_dir() at some point\nin all four cases. The hash algorithm though is configured later after\n.git/config is read.\n\nSo far proper repo initialization is done only for the first case [1].\nThe second case is not covered (but that's fine [3]). The third case\nwas found and worked around in [2]. The fourth case is a buggy one,\nwhich should be fixed already by jk/no-looking-at-dotgit-outside-repo\nand never happens again.\n\nThis patch makes sure all cases initialize the hash algorithm in\nthe_repository correctly. Both second and third cases must run\ncheck_repo_format() before \"entering\" it. Eventually we probably just\nrename this function to init_repo() or something.\n\nPS. cases where we don't have a repo but still need hash algo are\nobviously not covered here.\n\n[1] 78a6766802 (Integrate hash algorithm support with repo setup -\n    2017-11-12)\n\n[2] e26f7f19b6 (repository: pre-initialize hash algo pointer -\n    2018-01-19)\n\n[3] the reason server side is still running ok with no hash algo before\n    [2] is because the programs that use enter_repo() do very\n    little (and unlikely to hash anything) then spawn a new\n    program (like pack-objects or upload-archive) to do the heavy\n    lifting. These programs already use setup_git_directory() or the\n    gently version\n\nSigned-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>","distinct":true,"url":"https://api.github.com/repos/pclouds/git/commits/3f95d2b772998da0361d270e079887647473c4ca"},{"sha":"ddba4c76f5bbef6a56758460b5037e20baa499d7","author":{"name":"Nguyễn Thái Ngọc Duy","email":"d0e3b15a74ff6c70e81434a55b9c843230dc3715@gmail.com"},"message":"setup_explicit_git_dir: share common exit code","distinct":true,"url":"https://api.github.com/repos/pclouds/git/commits/ddba4c76f5bbef6a56758460b5037e20baa499d7"},{"sha":"aba4f972cdc98c0b79810e2cc65780073c299aa6","author":{"name":"Nguyễn Thái Ngọc Duy","email":"d0e3b15a74ff6c70e81434a55b9c843230dc3715@gmail.com"},"message":"setup_explicit_git_dir: reorder an if block\n\nInstead of doing\n\n    if (offset >= 0) {\n        ...\n\tgoto done;\n    }\n    /* cwd outside worktree */\n    ...\n    done:\n\nNow we exit early when offset < 0. The reason is there eventually will\nbe no code in the \"cwd outside worktree\" case except going to the\nfinish line. The comment would be lonely there at the end.","distinct":true,"url":"https://api.github.com/repos/pclouds/git/commits/aba4f972cdc98c0b79810e2cc65780073c299aa6"},{"sha":"37ebeecafc03ea9f551f64ec18c9eccfbe1b8751","author":{"name":"Nguyễn Thái Ngọc Duy","email":"d0e3b15a74ff6c70e81434a55b9c843230dc3715@gmail.com"},"message":"setup_explicit_git_dir: delay set_git_work_tree() until the end","distinct":true,"url":"https://api.github.com/repos/pclouds/git/commits/37ebeecafc03ea9f551f64ec18c9eccfbe1b8751"},{"sha":"ce2282b717f439a7c66a050d96a97c0c74528fe4","author":{"name":"Nguyễn Thái Ngọc Duy","email":"d0e3b15a74ff6c70e81434a55b9c843230dc3715@gmail.com"},"message":"setup_explicit_git_dir: delay set_git_dir() until the end","distinct":true,"url":"https://api.github.com/repos/pclouds/git/commits/ce2282b717f439a7c66a050d96a97c0c74528fe4"},{"sha":"5bb7ffd072ac1d6e488e6ff880d2857d62a00399","author":{"name":"Nguyễn Thái Ngọc Duy","email":"d0e3b15a74ff6c70e81434a55b9c843230dc3715@gmail.com"},"message":"setup_discovered_git_dir: delay set_git_dir() until the end\n\nYes the found_git_dir_but_dont_setenv thing is weird and should be\nfixed. But messing with environment variable usually has unseen\nconsequences. Let's leave it for now.","distinct":true,"url":"https://api.github.com/repos/pclouds/git/commits/5bb7ffd072ac1d6e488e6ff880d2857d62a00399"},{"sha":"6b35c8e6a1f6f396f7cb82c6acfde35e2f4d35dc","author":{"name":"Nguyễn Thái Ngọc Duy","email":"d0e3b15a74ff6c70e81434a55b9c843230dc3715@gmail.com"},"message":"setup_discovered_git_dir: delay set_git_work_tree() until the end","distinct":true,"url":"https://api.github.com/repos/pclouds/git/commits/6b35c8e6a1f6f396f7cb82c6acfde35e2f4d35dc"},{"sha":"fc2d46b5f5195b25704bd734628aab9717974ce9","author":{"name":"Nguyễn Thái Ngọc Duy","email":"d0e3b15a74ff6c70e81434a55b9c843230dc3715@gmail.com"},"message":"setup_git_directory_gently: delay set_git_* until the end","distinct":true,"url":"https://api.github.com/repos/pclouds/git/commits/fc2d46b5f5195b25704bd734628aab9717974ce9"},{"sha":"671480e6ed8840c5525144612ff95e35cbc04e69","author":{"name":"Nguyễn Thái Ngọc Duy","email":"d0e3b15a74ff6c70e81434a55b9c843230dc3715@gmail.com"},"message":"setup_git_directory_gently: delay setenv until the end","distinct":true,"url":"https://api.github.com/repos/pclouds/git/commits/671480e6ed8840c5525144612ff95e35cbc04e69"},{"sha":"141b75c74e55967008c66e3ffc73861b2c07a4a4","author":{"name":"Nguyễn Thái Ngọc Duy","email":"d0e3b15a74ff6c70e81434a55b9c843230dc3715@gmail.com"},"message":"setup_git_directory_gently: keep nongit_ok handling to itself\n\nLet the helper functions act more like library functions where they\nset an error message and abort execution instead of deciding\nthemselves whether to die or to show a warning.\n\nNote that this always set *nongit_ok to 1 while the current code\nsometimes sets to -1. This does not matter anyway because nobody\nbothers with positive or negative value, just zero or non-zero.","distinct":true,"url":"https://api.github.com/repos/pclouds/git/commits/141b75c74e55967008c66e3ffc73861b2c07a4a4"},{"sha":"c0cf04c95eb9758a5fffdbe66406dc83c065087c","author":{"name":"Nguyễn Thái Ngọc Duy","email":"d0e3b15a74ff6c70e81434a55b9c843230dc3715@gmail.com"},"message":"setup_git_directory_gently: clean up a common block","distinct":true,"url":"https://api.github.com/repos/pclouds/git/commits/c0cf04c95eb9758a5fffdbe66406dc83c065087c"},{"sha":"1955008f7056321d924e95e28aed572f2931c145","author":{"name":"Nguyễn Thái Ngọc Duy","email":"d0e3b15a74ff6c70e81434a55b9c843230dc3715@gmail.com"},"message":"setup_explicit_git_dir: avoid is_bare_repository_cfg\n\nEventually is_bare_repository_cfg will be gone. This is one step\ntowards doing without one. Note that this shows a strange behavior in\ncurrent code: we prefer config over command line, but it is usually\nthe other way around.","distinct":true,"url":"https://api.github.com/repos/pclouds/git/commits/1955008f7056321d924e95e28aed572f2931c145"},{"sha":"09219f4182a3083a7c5108ab74cc9e6fc1198fd2","author":{"name":"Nguyễn Thái Ngọc Duy","email":"d0e3b15a74ff6c70e81434a55b9c843230dc3715@gmail.com"},"message":"setup_explicit_git_dir: avoid git_work_tree_cfg\n\nThere is no reason to look at the global variable because the\ninformation can only come from one source, config file, which is read\nearly during discovery phase and all contained in repo_fmt.","distinct":true,"url":"https://api.github.com/repos/pclouds/git/commits/09219f4182a3083a7c5108ab74cc9e6fc1198fd2"},{"sha":"160e55e2e2de2b60413af591b0015bdddbcaa979","author":{"name":"Nguyễn Thái Ngọc Duy","email":"d0e3b15a74ff6c70e81434a55b9c843230dc3715@gmail.com"},"message":"setup_directory_gently: delay updating inside_git_dir until the end","distinct":true,"url":"https://api.github.com/repos/pclouds/git/commits/160e55e2e2de2b60413af591b0015bdddbcaa979"},{"sha":"d6caa884dc022dd08c41066a361ce43dfd6ed372","author":{"name":"Nguyễn Thái Ngọc Duy","email":"d0e3b15a74ff6c70e81434a55b9c843230dc3715@gmail.com"},"message":"setup_directory_gently: delay updating inside_work_tree until the end\n\nNote that when check_repository_format_gently() is called inside\nsetup_directory_gently() may reset inside_* back to -1. But it can't\nreally override the decision made by setup_*_git_dir() because those\nare made after it's called anyway.","distinct":true,"url":"https://api.github.com/repos/pclouds/git/commits/d6caa884dc022dd08c41066a361ce43dfd6ed372"},{"sha":"a1cf349ec0859848fd43398051383648f707a569","author":{"name":"Nguyễn Thái Ngọc Duy","email":"d0e3b15a74ff6c70e81434a55b9c843230dc3715@gmail.com"},"message":"setup: delete startup_info->have_directory\n\nstartup_info->have_directory is the equivalent of\nthe_repository->gitdir != NULL, which should be set once set_git_dir()\nis called.\n\nIt's hard to see from the diff context, but the have_repository\nassignment in setup_git_directory_gently is immediately followed by a\nset_git_dir(). The one in check_repo_format() is not, but its two\ncallers do call set_git_dir(). The one in init-db.c goes the extra\nmile of setting it one more time. The other hidden one is enter_repo()\nin path.c.","distinct":true,"url":"https://api.github.com/repos/pclouds/git/commits/a1cf349ec0859848fd43398051383648f707a569"},{"sha":"7955fff6e252b0808c535a2b4b1408801bf0fe4e","author":{"name":"Nguyễn Thái Ngọc Duy","email":"d0e3b15a74ff6c70e81434a55b9c843230dc3715@gmail.com"},"message":"update-index: avoid startup_info->prefix","distinct":true,"url":"https://api.github.com/repos/pclouds/git/commits/7955fff6e252b0808c535a2b4b1408801bf0fe4e"},{"sha":"94ccd61815abd278007923386a7281fcd24f32c2","author":{"name":"Nguyễn Thái Ngọc Duy","email":"d0e3b15a74ff6c70e81434a55b9c843230dc3715@gmail.com"},"message":"Move startup_info->prefix to the_repository->prefix","distinct":true,"url":"https://api.github.com/repos/pclouds/git/commits/94ccd61815abd278007923386a7281fcd24f32c2"}]}
{"actor":{"display_login":"pclouds"}}