summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* Documentation/git-rm: correct submodule descriptionsb/submodule-rm-absorbStefan Beller2017-06-041-4/+5
| | | | | | | | | Since 3ccd681c2a (Merge branch 'sb/submodule-rm-absorb', 2017-01-18) git-rm tries to absorb any submodules git dir before deleting the submodule. Correct the documentation to say so. Signed-off-by: Stefan Beller <sbeller@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* submodule.c: add missing ' in error messagesRalf Thielow2017-04-131-2/+2
| | | | | | Signed-off-by: Ralf Thielow <ralf.thielow@gmail.com> Acked-by: Stefan Beller <sbeller@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* rm: absorb a submodules git dir before deletionStefan Beller2016-12-272-87/+36
| | | | | | | | | | | | | | | | | | | | | | | | When deleting a submodule, we need to keep the actual git directory around, such that we do not lose local changes in there and at a later checkout of the submodule we don't need to clone it again. Now that the functionality is available to absorb the git directory of a submodule, rewrite the checking in git-rm to not complain, but rather relocate the git directories inside the superproject. An alternative solution was discussed to have a function `depopulate_submodule`. That would couple the check for its git directory and possible relocation before the the removal, such that it is less likely to miss the check in the future. But the indirection with such a function added seemed also complex. The reason for that was that this possible move of the git directory was also implemented in `ok_to_remove_submodule`, such that this function could truthfully answer whether it is ok to remove the submodule. The solution proposed here defers all these checks to the caller. Signed-off-by: Stefan Beller <sbeller@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* submodule: rename and add flags to ok_to_remove_submoduleStefan Beller2016-12-273-14/+45
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In different contexts the question "Is it ok to delete a submodule?" may be answered differently. In 293ab15eea (submodule: teach rm to remove submodules unless they contain a git directory, 2012-09-26) a case was made that we can safely ignore ignored untracked files for removal as we explicitely ask for the removal of the submodule. In a later patch we want to remove submodules even when the user doesn't explicitly ask for it (e.g. checking out a tree-ish in which the submodule doesn't exist). In that case we want to be more careful when it comes to deletion of untracked files. As of this patch it is unclear how this will be implemented exactly, so we'll offer flags in which the caller can specify how the different untracked files ought to be handled. As the flags allow the function to not die on an error when spawning a child process, we need to find an appropriate return code for the case when the child process could not be started. As in that case we cannot tell if the submodule is ok to remove, we'd want to return 'false'. As only 0 is understood as false, rename the function to invert the meaning, i.e. the return code of 0 signals the removal of the submodule is fine, and other values can be used to return a more precise answer what went wrong. Signed-off-by: Stefan Beller <sbeller@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* submodule: modernize ok_to_remove_submodule to use argv_arrayStefan Beller2016-12-271-10/+4
| | | | | | | | | | Instead of constructing the NULL terminated array ourselves, we should make use of the argv_array infrastructure. While at it, adapt the error messages to reflect the actual invocation. Signed-off-by: Stefan Beller <sbeller@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* submodule.h: add extern keyword to functionsStefan Beller2016-12-271-25/+30
| | | | | | | | | | | | | | | | As the upcoming series will add a lot of functions to the submodule header, let's first make the header consistent to the rest of the project by adding the extern keyword to functions. As per the CodingGuidelines we try to stay below 80 characters per line, so adapt all those functions to stay below 80 characters that are already using more than one line. Those function using just one line are better kept in one line than breaking them up into multiple lines just for the goal of staying below the character limit as it makes grepping for functions easier if they are one liners. Signed-off-by: Stefan Beller <sbeller@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* worktree: initialize return value for submodule_uses_worktreesStefan Beller2016-12-271-1/+1
| | | | | | | | When the worktrees directory is empty, the `ret` will be returned uninitialized. Fix it by initializing the value. Signed-off-by: Stefan Beller <sbeller@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* submodule: add absorb-git-dir functionStefan Beller2016-12-128-1/+282
| | | | | | | | | | | | | | | | | | | | When a submodule has its git dir inside the working dir, the submodule support for checkout that we plan to add in a later patch will fail. Add functionality to migrate the git directory to be absorbed into the superprojects git directory. The newly added code in this patch is structured such that other areas of Git can also make use of it. The code in the submodule--helper is a mere wrapper and option parser for the function `absorb_git_dir_into_superproject`, that takes care of embedding the submodules git directory into the superprojects git dir. That function makes use of the more abstract function for this use case `relocate_gitdir`, which can be used by e.g. the worktree code eventually to move around a git directory. Signed-off-by: Stefan Beller <sbeller@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* move connect_work_tree_and_git_dir to dir.hStefan Beller2016-12-124-26/+26
| | | | | | | | | | That function was primarily used by submodule code, but the function itself is not inherently about submodules. In the next patch we'll introduce relocate_git_dir, which can be used by worktrees as well, so find a neutral middle ground in dir.h. Signed-off-by: Stefan Beller <sbeller@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* worktree: check if a submodule uses worktreesStefan Beller2016-12-122-0/+55
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | In a later patch we want to move around the the git directory of a submodule. Both submodules as well as worktrees are involved in placing git directories at unusual places, so their functionality may collide. To react appropriately to situations where worktrees in submodules are in use, offer a new function to query the a submodule if it uses the worktree feature. An earlier approach: "Implement submodule_get_worktrees and just count them", however: This can be done cheaply (both in new code to write as well as run time) by obtaining the list of worktrees based off that submodules git directory. However as we have loaded the variables for the current repository, the values in the submodule worktree can be wrong, e.g. * core.ignorecase may differ between these two repositories * the ref resolution is broken (refs/heads/branch in the submodule resolves to the sha1 value of the `branch` in the current repository that may not exist or have another sha1) The implementation here is just checking for any files in $GIT_COMMON_DIR/worktrees for the submodule, which ought to be sufficient if the submodule is using the current repository format, which we also check. Signed-off-by: Stefan Beller <sbeller@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* test-lib-functions.sh: teach test_commit -C <dir>Stefan Beller2016-12-091-5/+15
| | | | | | | | | | Specifically when setting up submodule tests, it comes in handy if we can create commits in repositories that are not at the root of the tested trash dir. Add "-C <dir>" similar to gits -C parameter that will perform the operation in the given directory. Signed-off-by: Stefan Beller <sbeller@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* submodule helper: support super prefixStefan Beller2016-12-092-12/+21
| | | | | | | | | | Just like main commands in Git, the submodule helper needs access to the superproject prefix. Enable this in the git.c but have its own fuse in the helper code by having a flag to turn on the super prefix. Signed-off-by: Stefan Beller <sbeller@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* submodule: use absolute path for computing relative path connectingStefan Beller2016-12-091-6/+7
| | | | | | | | | | | | | | | The current caller of connect_work_tree_and_git_dir passes an absolute path for the `git_dir` parameter. In the future patch we will also pass in relative path for `git_dir`. Extend the functionality of connect_work_tree_and_git_dir to take relative paths for parameters. We could work around this in the future patch by computing the absolute path for the git_dir in the calling site, however accepting relative paths for either parameter makes the API for this function much harder to misuse. Signed-off-by: Stefan Beller <sbeller@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* worktree list: keep the list sortednd/worktree-list-fixupNguyễn Thái Ngọc Duy2016-11-284-1/+36
| | | | | | | | | It makes it easier to write tests for. But it should also be good for the user since locating a worktree by eye would be easier once they notice this. Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* worktree.c: get_worktrees() takes a new flag argumentNguyễn Thái Ngọc Duy2016-11-285-8/+8
| | | | | | | | This is another no-op patch, in preparation for get_worktrees() to do optional things, like sorting. Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* get_worktrees() must return main worktree as first item even on errorNguyễn Thái Ngọc Duy2016-11-283-9/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is required by git-worktree.txt, stating that the main worktree is the first line (especially in --porcelain mode when we can't just change behavior at will). There's only one case when get_worktrees() may skip main worktree, when parse_ref() fails. Update the code so that we keep first item as main worktree and return something sensible in this case: - In user-friendly mode, since we're not constraint by anything, returning "(error)" should do the job (we already show "(detached HEAD)" which is not machine-friendly). Actually errors should be printed on stderr by parse_ref() (*) - In plumbing mode, we do not show neither 'bare', 'detached' or 'branch ...', which is possible by the format description if I read it right. Careful readers may realize that when the local variable "head_ref" in get_main_worktree() is emptied, add_head_info() will do nothing to wt->head_sha1. But that's ok because head_sha1 is zero-ized in the previous patch. (*) Well, it does not. But it's supposed to be a stop gap implementation until we can reuse refs code to parse "ref: " stuff in HEAD, from resolve_refs_unsafe(). Now may be the time since refs refactoring is mostly done. Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* worktree: reorder an if statementNguyễn Thái Ngọc Duy2016-11-281-3/+3
| | | | | | | This is no-op. But it helps reduce diff noise in the next patch. Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* worktree.c: zero new 'struct worktree' on allocationNguyễn Thái Ngọc Duy2016-11-231-12/+2
| | | | | | | | This keeps things a bit simpler when we add more fields, knowing that default values are always zero. Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* Merge tag 'l10n-2.11.0-rnd2' of git://github.com/git-l10n/git-poJunio C Hamano2016-11-228-16103/+23112
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | l10n-2.11.0-rnd2 * tag 'l10n-2.11.0-rnd2' of git://github.com/git-l10n/git-po: l10n: Fixed typo of git fetch-pack command l10n: git.pot: v2.11.0 round 2 (1 new, 1 removed) l10n: zh_CN: for git v2.11.0 l10n round 1 l10n: pt_PT: update Portuguese translation l10n: fr.po fix grammar mistakes l10n: fr.po v2.11.0_rnd1 l10n: sv.po: Update Swedish translation (2913t0f0u) l10n: vi.po: Updated translation to v2.11.0 (2913t) l10n: ko.po: Update Korean translation l10n: git.pot: v2.11.0 round 1 (209 new, 53 removed) l10n: ru.po: update Russian translation
| * l10n: Fixed typo of git fetch-pack commandJiang Xin2016-11-226-183/+282
| | | | | | | | | | | | | | Git 2.11.0-rc2 introduced one small l10n update, and this commit fixed the affected translations all in one batch. Signed-off-by: Jiang Xin <worldhello.net@gmail.com>
| * l10n: git.pot: v2.11.0 round 2 (1 new, 1 removed)Jiang Xin2016-11-221-9/+9
| | | | | | | | | | | | Generate po/git.pot from v2.11.0-rc2 for git v2.11.0 l10n round 2. Signed-off-by: Jiang Xin <worldhello.net@gmail.com>
| * Merge branch 'master' of git://github.com/git-l10n/git-poJiang Xin2016-11-228-16066/+22976
| |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 'master' of git://github.com/git-l10n/git-po: l10n: zh_CN: for git v2.11.0 l10n round 1 l10n: pt_PT: update Portuguese translation l10n: fr.po fix grammar mistakes l10n: fr.po v2.11.0_rnd1 l10n: sv.po: Update Swedish translation (2913t0f0u) l10n: vi.po: Updated translation to v2.11.0 (2913t) l10n: ko.po: Update Korean translation l10n: git.pot: v2.11.0 round 1 (209 new, 53 removed) l10n: ru.po: update Russian translation
| | * l10n: zh_CN: for git v2.11.0 l10n round 1Jiang Xin2016-11-211-2002/+2897
| | | | | | | | | | | | | | | | | | Update 209 translations (2913t0f0u) for git v2.11.0-rc0. Signed-off-by: Jiang Xin <worldhello.net@gmail.com>
| | * l10n: pt_PT: update Portuguese translationVasco Almeida2016-11-131-2027/+2947
| | | | | | | | | | | | Signed-off-by: Vasco Almeida <vascomalmeida@sapo.pt>
| | * Merge branch 'fr_v2.11.0_rnd1' of git://github.com/jnavila/gitJiang Xin2016-11-091-2047/+2922
| | |\ | | | | | | | | | | | | | | | | | | | | * 'fr_v2.11.0_rnd1' of git://github.com/jnavila/git: l10n: fr.po fix grammar mistakes l10n: fr.po v2.11.0_rnd1
| | | * l10n: fr.po fix grammar mistakesjfbu2016-11-061-11/+7
| | | | | | | | | | | | | | | | | | | | Signed-off-by: Jean-Noel Avila <jn.avila@free.fr> Signed-off-by: jfbu <jfbu@free.fr>
| | | * l10n: fr.po v2.11.0_rnd1Jean-Noel Avila2016-11-051-2037/+2916
| | | | | | | | | | | | | | | | Signed-off-by: Jean-Noel Avila <jn.avila@free.fr>
| | * | l10n: sv.po: Update Swedish translation (2913t0f0u)Peter Krefting2016-11-051-2019/+2936
| | | | | | | | | | | | | | | | Signed-off-by: Peter Krefting <peter@softwolves.pp.se>
| | * | Merge branch 'ko/merge-l10n' of https://github.com/changwoo/git-l10n-koJiang Xin2016-11-051-2230/+2946
| | |\ \ | | | | | | | | | | | | | | | | | | | | * 'ko/merge-l10n' of https://github.com/changwoo/git-l10n-ko: l10n: ko.po: Update Korean translation
| | | * | l10n: ko.po: Update Korean translationChangwoo Ryu2016-11-041-2230/+2946
| | | | | | | | | | | | | | | | | | | | Signed-off-by: Changwoo Ryu <cwryu@debian.org>
| | * | | l10n: vi.po: Updated translation to v2.11.0 (2913t)Tran Ngoc Quan2016-11-041-2016/+2930
| | |/ / | | | | | | | | | | | | Signed-off-by: Tran Ngoc Quan <vnwildman@gmail.com>
| | * | Merge branch 'russian-l10n' of https://github.com/DJm00n/git-po-ruJiang Xin2016-11-021-1773/+2656
| | |\ \ | | | |/ | | |/| | | | | | | | | * 'russian-l10n' of https://github.com/DJm00n/git-po-ru: l10n: ru.po: update Russian translation
| | | * l10n: ru.po: update Russian translationDimitriy Ryazantcev2016-10-161-1773/+2656
| | | | | | | | | | | | | | | | Signed-off-by: Dimitriy Ryazantcev <dimitriy.ryazantcev@gmail.com>
| | * | l10n: git.pot: v2.11.0 round 1 (209 new, 53 removed)Jiang Xin2016-11-011-1952/+2742
| | | | | | | | | | | | | | | | | | | | | | | | Generate po/git.pot from v2.11.0-rc0 for git v2.11.0 l10n round 1. Signed-off-by: Jiang Xin <worldhello.net@gmail.com>
* | | | Merge branch 'js/prepare-sequencer'Junio C Hamano2016-11-221-1/+1
|\ \ \ \ | |/ / / |/| | | | | | | | | | | | | | | | | | | Fix for an error message string. * js/prepare-sequencer: i18n: fix unmatched single quote in error message
| * | | i18n: fix unmatched single quote in error messagejs/prepare-sequencerJiang Xin2016-11-211-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixed unmatched single quote introduced by commit: * f56fffef9a sequencer: teach write_message() to append an optional LF Signed-off-by: Jiang Xin <worldhello.net@gmail.com> Acked-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | | | Git 2.11-rc2v2.11.0-rc2Junio C Hamano2016-11-172-1/+4
| | | | | | | | | | | | | | | | Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | | | Merge branch 'tk/diffcore-delta-remove-unused'Junio C Hamano2016-11-175-8/+1
|\ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Code cleanup. * tk/diffcore-delta-remove-unused: diffcore-delta: remove unused parameter to diffcore_count_changes()
| * | | | diffcore-delta: remove unused parameter to diffcore_count_changes()tk/diffcore-delta-remove-unusedTobias Klauser2016-11-145-8/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The delta_limit parameter to diffcore_count_changes() has been unused since commit ba23bbc8e ("diffcore-delta: make change counter to byte oriented again.", 2006-03-04). Remove the parameter and adjust all callers. Signed-off-by: Tobias Klauser <tklauser@distanz.ch> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | | | | Merge branch 'jk/create-branch-remove-unused-param'Junio C Hamano2016-11-174-13/+18
|\ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Code clean-up. * jk/create-branch-remove-unused-param: create_branch: drop unused "head" parameter
| * | | | | create_branch: drop unused "head" parameterjk/create-branch-remove-unused-paramJeff King2016-11-094-13/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This function used to have the caller pass in the current value of HEAD, in order to make sure we didn't clobber HEAD. In 55c4a6730, that logic moved to validate_new_branchname(), which just resolves HEAD itself. The parameter to create_branch is now unused. Since we have to update and re-wrap the docstring describing the parameters anyway, let's take this opportunity to break it out into a list, which makes it easier to find the parameters. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | | | | | Merge branch 'nd/worktree-lock'Junio C Hamano2016-11-171-1/+1
|\ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Typofix. * nd/worktree-lock: git-worktree.txt: fix typo "to"/"two", and add comma
| * | | | | | git-worktree.txt: fix typo "to"/"two", and add command/worktree-lockBen North2016-11-131-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Signed-off-by: Ben North <ben@redfrontdoor.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | | | | | | Git 2.11.0-rc1v2.11.0-rc1Junio C Hamano2016-11-111-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | | | | | | Merge branch 'rt/fetch-pack-error-message-fix'Junio C Hamano2016-11-111-1/+1
|\ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | An error message in fetch-pack executable that was newly marked for translation was misspelt, which has been fixed. * rt/fetch-pack-error-message-fix: fetch-pack.c: correct command at the beginning of an error message
| * | | | | | | fetch-pack.c: correct command at the beginning of an error messagert/fetch-pack-error-message-fixRalf Thielow2016-11-111-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | One error message in fetch-pack.c uses 'git fetch_pack' at the beginning which is not a git command. Use 'git fetch-pack' instead. Signed-off-by: Ralf Thielow <ralf.thielow@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | | | | | | | Merge branch 'ps/common-info-doc'Junio C Hamano2016-11-111-1/+1
|\ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Doc fix. * ps/common-info-doc: doc: fix location of 'info/' with $GIT_COMMON_DIR
| * | | | | | | | doc: fix location of 'info/' with $GIT_COMMON_DIRps/common-info-docPatrick Steinhardt2016-11-111-1/+1
| | |_|_|/ / / / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | With the introduction of the $GIT_COMMON_DIR variable, the repository layout manual was changed to reflect the location for many files in case the variable is set. While adding the new locations, one typo snuck in regarding the location of the 'info/' folder, which is falsely claimed to reside at "$GIT_COMMON_DIR/index". Fix the typo to point to "$GIT_COMMON_DIR/info/" instead. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* | | | | | | | Merge branch 'js/pwd-var-vs-pwd-cmd-fix'Junio C Hamano2016-11-112-3/+3
|\ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Last minute fixes to two fixups merged to 'master' recently. * js/pwd-var-vs-pwd-cmd-fix: t0021, t5615: use $PWD instead of $(pwd) in PATH-like shell variables
| * | | | | | | | t0021, t5615: use $PWD instead of $(pwd) in PATH-like shell variablesjs/pwd-var-vs-pwd-cmd-fixJohannes Sixt2016-11-112-3/+3
| | |/ / / / / / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We have to use $PWD instead of $(pwd) because on Windows the latter would add a C: style path to bash's Unix-style $PATH variable, which becomes confused by the colon after the drive letter. ($PWD is a Unix-style path.) In the case of GIT_ALTERNATE_OBJECT_DIRECTORIES, bash on Windows assembles a Unix-style path list with the colon as separators. It converts the value to a Windows-style path list with the semicolon as path separator when it forwards the variable to git.exe. The same confusion happens when bash's original value is contaminated with Windows style paths. Signed-off-by: Johannes Sixt <j6t@kdbg.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>