summaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2014-12-01prune: strategies for linked checkoutsLibravatar Nguyễn Thái Ngọc Duy7-2/+251
(alias R=$GIT_COMMON_DIR/worktrees/<id>) - linked checkouts are supposed to keep its location in $R/gitdir up to date. The use case is auto fixup after a manual checkout move. - linked checkouts are supposed to update mtime of $R/gitdir. If $R/gitdir's mtime is older than a limit, and it points to nowhere, worktrees/<id> is to be pruned. - If $R/locked exists, worktrees/<id> is not supposed to be pruned. If $R/locked exists and $R/gitdir's mtime is older than a really long limit, warn about old unused repo. - "git checkout --to" is supposed to make a hard link named $R/link pointing to the .git file on supported file systems to help detect the user manually deleting the checkout. If $R/link exists and its link count is greated than 1, the repo is kept. Helped-by: Marc Branchaud <marcnarc@xiplink.com> Helped-by: Eric Sunshine <sunshine@sunshineco.com> Helped-by: Johannes Sixt <j6t@kdbg.org> Signed-off-by: Marc Branchaud <marcnarc@xiplink.com> Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-12-01checkout: support checking out into a new working directoryLibravatar Nguyễn Thái Ngọc Duy6-4/+212
"git checkout --to" sets up a new working directory with a .git file pointing to $GIT_DIR/worktrees/<id>. It then executes "git checkout" again on the new worktree with the same arguments except "--to" is taken out. The second checkout execution, which is not contaminated with any info from the current repository, will actually check out and everything that normal "git checkout" does. Helped-by: Marc Branchaud <marcnarc@xiplink.com> Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-12-01use new wrapper write_file() for simple file writingLibravatar Nguyễn Thái Ngọc Duy5-31/+8
This fixes common problems in these code about error handling, forgetting to close the file handle after fprintf() fails, or not printing out the error string.. Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-12-01wrapper.c: wrapper to open a file, fprintf then closeLibravatar Nguyễn Thái Ngọc Duy2-0/+33
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-12-01setup.c: support multi-checkout repo setupLibravatar Nguyễn Thái Ngọc Duy9-14/+115
The repo setup procedure is updated to detect $GIT_DIR/commondir and set $GIT_COMMON_DIR properly. The core.worktree is ignored when $GIT_COMMON_DIR is set. This is because the config file is shared in multi-checkout setup, but checkout directories _are_ different. Making core.worktree effective in all checkouts mean it's back to a single checkout. Helped-by: Johannes Sixt <j6t@kdbg.org> Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-12-01setup.c: detect $GIT_COMMON_DIR check_repository_format_gently()Libravatar Nguyễn Thái Ngọc Duy1-2/+4
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-12-01setup.c: convert check_repository_format_gently to use strbufLibravatar Nguyễn Thái Ngọc Duy1-4/+8
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-12-01setup.c: detect $GIT_COMMON_DIR in is_git_directory()Libravatar Nguyễn Thái Ngọc Duy2-6/+44
If the file "$GIT_DIR/commondir" exists, it contains the value of $GIT_COMMON_DIR. Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-12-01setup.c: convert is_git_directory() to use strbufLibravatar Nguyễn Thái Ngọc Duy1-16/+21
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-12-01git-stash: avoid hardcoding $GIT_DIR/logs/....Libravatar Nguyễn Thái Ngọc Duy1-2/+2
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-12-01*.sh: avoid hardcoding $GIT_DIR/hooks/...Libravatar Nguyễn Thái Ngọc Duy6-24/+22
If $GIT_COMMON_DIR is set, it should be $GIT_COMMON_DIR/hooks/, not $GIT_DIR/hooks/. Just let rev-parse --git-path handle it. Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-12-01git-sh-setup.sh: use rev-parse --git-path to get $GIT_DIR/objectsLibravatar Nguyễn Thái Ngọc Duy1-1/+1
If $GIT_COMMON_DIR is set, $GIT_OBJECT_DIRECTORY should be $GIT_COMMON_DIR/objects, not $GIT_DIR/objects. Just let rev-parse --git-path handle it. Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-12-01$GIT_COMMON_DIR: a new environment variableLibravatar Nguyễn Thái Ngọc Duy6-19/+117
This variable is intended to support multiple working directories attached to a repository. Such a repository may have a main working directory, created by either "git init" or "git clone" and one or more linked working directories. These working directories and the main repository share the same repository directory. In linked working directories, $GIT_COMMON_DIR must be defined to point to the real repository directory and $GIT_DIR points to an unused subdirectory inside $GIT_COMMON_DIR. File locations inside the repository are reorganized from the linked worktree view point: - worktree-specific such as HEAD, logs/HEAD, index, other top-level refs and unrecognized files are from $GIT_DIR. - the rest like objects, refs, info, hooks, packed-refs, shallow... are from $GIT_COMMON_DIR (except info/sparse-checkout, but that's a separate patch) Scripts are supposed to retrieve paths in $GIT_DIR with "git rev-parse --git-path", which will take care of "$GIT_DIR vs $GIT_COMMON_DIR" business. The redirection is done by git_path(), git_pathdup() and strbuf_git_path(). The selected list of paths goes to $GIT_COMMON_DIR, not the other way around in case a developer adds a new worktree-specific file and it's accidentally promoted to be shared across repositories (this includes unknown files added by third party commands) The list of known files that belong to $GIT_DIR are: ADD_EDIT.patch BISECT_ANCESTORS_OK BISECT_EXPECTED_REV BISECT_LOG BISECT_NAMES CHERRY_PICK_HEAD COMMIT_MSG FETCH_HEAD HEAD MERGE_HEAD MERGE_MODE MERGE_RR NOTES_EDITMSG NOTES_MERGE_WORKTREE ORIG_HEAD REVERT_HEAD SQUASH_MSG TAG_EDITMSG fast_import_crash_* logs/HEAD next-index-* rebase-apply rebase-merge rsync-refs-* sequencer/* shallow_* Path mapping is NOT done for git_path_submodule(). Multi-checkouts are not supported as submodules. Helped-by: Jens Lehmann <Jens.Lehmann@web.de> Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-12-01commit: use SEQ_DIR instead of hardcoding "sequencer"Libravatar Nguyễn Thái Ngọc Duy1-1/+1
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-12-01fast-import: use git_path() for accessing .git dir instead of get_git_dir()Libravatar Nguyễn Thái Ngọc Duy1-4/+1
This allows git_path() to redirect info/fast-import to another place if needed Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-12-01reflog: avoid constructing .lock path with git_pathLibravatar Nguyễn Thái Ngọc Duy1-1/+1
Among pathnames in $GIT_DIR, e.g. "index" or "packed-refs", we want to automatically and silently map some of them to the $GIT_DIR of the repository we are borrowing from via $GIT_COMMON_DIR mechanism. When we formulate the pathname for its lockfile, we want it to be in the same location as its final destination. "index" is not shared and needs to remain in the borrowing repository, while "packed-refs" is shared and needs to go to the borrowed repository. git_path() could be taught about the ".lock" suffix and map "index.lock" and "packed-refs.lock" the same way their basenames are mapped, but instead the caller can help by asking where the basename (e.g. "index") is mapped to git_path() and then appending ".lock" after the mapping is done. Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-12-01*.sh: respect $GIT_INDEX_FILELibravatar Nguyễn Thái Ngọc Duy2-2/+2
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-12-01git_path(): be aware of file relocation in $GIT_DIRLibravatar Nguyễn Thái Ngọc Duy6-7/+95
We allow the user to relocate certain paths out of $GIT_DIR via environment variables, e.g. GIT_OBJECT_DIRECTORY, GIT_INDEX_FILE and GIT_GRAFT_FILE. Callers are not supposed to use git_path() or git_pathdup() to get those paths. Instead they must use get_object_directory(), get_index_file() and get_graft_file() respectively. This is inconvenient and could be missed in review (for example, there's git_path("objects/info/alternates") somewhere in sha1_file.c). This patch makes git_path() and git_pathdup() understand those environment variables. So if you set GIT_OBJECT_DIRECTORY to /foo/bar, git_path("objects/abc") should return /foo/bar/abc. The same is done for the two remaining env variables. "git rev-parse --git-path" is the wrapper for script use. This patch kinda reverts a0279e1 (setup_git_env: use git_pathdup instead of xmalloc + sprintf - 2014-06-19) because using git_pathdup here would result in infinite recursion: setup_git_env() -> git_pathdup("objects") -> .. -> adjust_git_path() -> get_object_directory() -> oops, git_object_directory is NOT set yet -> setup_git_env() I wanted to make git_pathdup_literal() that skips adjust_git_path(). But that won't work because later on when $GIT_COMMON_DIR is introduced, git_pathdup_literal("objects") needs adjust_git_path() to replace $GIT_DIR with $GIT_COMMON_DIR. Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-12-01path.c: group git_path(), git_pathdup() and strbuf_git_path() togetherLibravatar Nguyễn Thái Ngọc Duy1-10/+10
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-12-01path.c: rename vsnpath() to do_git_path()Libravatar Nguyễn Thái Ngọc Duy1-4/+4
The name vsnpath() gives an impression that this is general path handling function. It's not. This is the underlying implementation of git_path(), git_pathdup() and strbuf_git_path() which will prefix $GIT_DIR in the result string. Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-12-01git_snpath(): retire and replace with strbuf_git_path()Libravatar Nguyễn Thái Ngọc Duy5-26/+55
In the previous patch, git_snpath() is modified to allocate a new strbuf buffer because vsnpath() needs that. But that makes it awkward because git_snpath() receives a pre-allocated buffer from outside and has to copy data back. Rename it to strbuf_git_path() and make it receive strbuf directly. Using git_path() in update_refs_for_switch() which used to call git_snpath() is safe because that function and all of its callers do not keep any pointer to the round-robin buffer pool allocated by get_pathname(). Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-12-01path.c: make get_pathname() call sites return const char *Libravatar Nguyễn Thái Ngọc Duy15-32/+36
Before the previous commit, get_pathname returns an array of PATH_MAX length. Even if git_path() and similar functions does not use the whole array, git_path() caller can, in theory. After the commit, get_pathname() may return a buffer that has just enough room for the returned string and git_path() caller should never write beyond that. Make git_path(), mkpath() and git_path_submodule() return a const buffer to make sure callers do not write in it at all. This could have been part of the previous commit, but the "const" conversion is too much distraction from the core changes in path.c. Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-12-01path.c: make get_pathname() return strbuf instead of static bufferLibravatar Nguyễn Thái Ngọc Duy1-69/+51
We've been avoiding PATH_MAX whenever possible. This patch makes get_pathname() return a strbuf and updates the callers to take advantage of this. The code is simplified as we no longer need to worry about buffer overflow. vsnpath() behavior is changed slightly: previously it always clears the buffer before writing, now it just appends. Fortunately this is a static function and all of its callers prepare the buffer properly: git_path() gets the buffer from get_pathname() which resets the buffer, the remaining call sites start with STRBUF_INIT'd buffer. Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-11-26Git 2.2Libravatar Junio C Hamano2-1/+6
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-11-26RelNotes: spelling & grammar tweaksLibravatar Marc Branchaud1-51/+52
Signed-off-by: Marc Branchaud <marcnarc@xiplink.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-11-21Git 2.2.0-rc3Libravatar Junio C Hamano2-14/+15
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-11-20l10n: remove a superfluous translation for push.cLibravatar Jiang Xin6-30/+6
Ralf reported that '--recurse-submodules' option in push.c should not be translated [1]. Before his commit is merged, remove superfluous translations for push.c. [1] http://www.spinics.net/lists/git/msg241964.html Signed-off-by: Jiang Xin <worldhello.net@gmail.com>
2014-11-20l10n: de.po: translate 2 messagesLibravatar Ralf Thielow1-3/+1
Signed-off-by: Ralf Thielow <ralf.thielow@gmail.com>
2014-11-20l10n: de.po: translate 2 new messagesLibravatar Ralf Thielow1-2/+2
Signed-off-by: Phillip Sz <phillip.szelat@gmail.com> Signed-off-by: Ralf Thielow <ralf.thielow@gmail.com>
2014-11-20l10n: batch updates for one trivial changeLibravatar Jiang Xin7-519/+554
In order to catch up with the release of Git 2.2.0 final, make a batch l10n update for the new l10n change brought by commit d52adf1 (trailer: display a trailer without its trailing newline). Signed-off-by: Jiang Xin <worldhello.net@gmail.com>
2014-11-20l10n: git.pot: v2.2.0 round 2 (1 updated)Libravatar Jiang Xin1-24/+24
Generate po/git.pot from v2.2.0-rc2-23-gca0107e for git v2.2.0 l10n round 2. Signed-off-by: Jiang Xin <worldhello.net@gmail.com>
2014-11-19Merge branch 'sv/submitting-final-patch'Libravatar Junio C Hamano1-1/+1
* sv/submitting-final-patch: SubmittingPatches: final submission is To: maintainer and CC: list
2014-11-19Merge branch 'sn/tutorial-status-output-example'Libravatar Junio C Hamano2-19/+21
* sn/tutorial-status-output-example: gittutorial: fix output of 'git status'
2014-11-19Merge branch 'mh/doc-remote-helper-xref'Libravatar Junio C Hamano5-0/+22
* mh/doc-remote-helper-xref: doc: add some crossrefs between manual pages
2014-11-19Merge branch 'tb/no-relative-file-url'Libravatar Junio C Hamano1-1/+1
* tb/no-relative-file-url: t5705: the file:// URL should be absolute
2014-11-19Merge branch 'cc/interpret-trailers'Libravatar Junio C Hamano1-4/+10
Small fixes to a new experimental command already in 'master'. * cc/interpret-trailers: trailer: display a trailer without its trailing newline trailer: ignore comment lines inside the trailers
2014-11-18Merge git://github.com/git-l10n/git-poLibravatar Junio C Hamano1-2165/+2392
* 'master' of git://github.com/git-l10n/git-po: l10n: Update Catalan translation
2014-11-18Merge branch 'jc/doc-commit-only'Libravatar Junio C Hamano1-2/+3
* jc/doc-commit-only: Documentation/git-commit: clarify that --only/--include records the working tree contents
2014-11-18Merge branch 'ta/tutorial-modernize'Libravatar Junio C Hamano1-1/+1
* ta/tutorial-modernize: gittutorial.txt: remove reference to ancient Git version
2014-11-18Merge branch 'da/difftool'Libravatar Junio C Hamano2-0/+6
Fix-up to a new feature in 'master'. * da/difftool: difftool: honor --trust-exit-code for builtin tools
2014-11-17l10n: Update Catalan translationLibravatar Alex Henrie1-2165/+2392
Signed-off-by: Alex Henrie <alexhenrie24@gmail.com>
2014-11-17Merge branch 'master' of git://github.com/git-l10n/git-poLibravatar Junio C Hamano1-1990/+2239
* 'master' of git://github.com/git-l10n/git-po: l10n: de.po: translate 62 new messages l10n: de.po: Fixup one translation l10n: de.po: use imperative form for command options
2014-11-15l10n: de.po: translate 62 new messagesLibravatar Ralf Thielow1-1414/+1663
Translate 62 new messages came from git.pot update in 16742b0 (l10n: git.pot: proposed updates for v2.2.0 (+62)). Signed-off-by: Ralf Thielow <ralf.thielow@gmail.com>
2014-11-15l10n: de.po: Fixup one translationLibravatar Stefan Beller1-4/+4
English grammar with German words doesn't make it a German translation. ;) Signed-off-by: Stefan Beller <stefanbeller@gmail.com> Signed-off-by: Ralf Thielow <ralf.thielow@gmail.com>
2014-11-14difftool: honor --trust-exit-code for builtin toolsLibravatar David Aguilar2-0/+6
run_merge_tool() was not setting $status, which prevented the exit code for builtin tools from being forwarded to the caller. Capture the exit status and add a test to guarantee the behavior. Reported-by: Adria Farres <14farresa@gmail.com> Signed-off-by: David Aguilar <davvid@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-11-14Git 2.2.0-rc2Libravatar Junio C Hamano1-1/+1
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-11-14l10n: de.po: use imperative form for command optionsLibravatar Ralf Thielow1-573/+573
Signed-off-by: Ralf Thielow <ralf.thielow@gmail.com>
2014-11-13gittutorial: fix output of 'git status'Libravatar Stefan Naewe2-19/+21
'git status' doesn't output leading '#'s these days. Signed-off-by: Stefan Naewe <stefan.naewe@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-11-13t5705: the file:// URL should be absoluteLibravatar Torsten Bögershausen1-1/+1
The test misused a URL "file://." to mean "relative to here", which we no longer accept. In a file:// URL, typically there is no host, and RFC1738 says that file:///<path> should be used. Update t5705 to use a working URL. Reported-by: Michael Blume <blume.mike@gmail.com> Signed-off-by: Torsten Bögershausen <tboegi@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-11-13SubmittingPatches: final submission is To: maintainer and CC: listLibravatar Slavomir Vlcek1-1/+1
In an earlier part there is: "re-send it with "To:" set to the maintainer [*1*] and "cc:" the list [*2*]" for the final submission, but later we see "Send it to the list and cc the maintainer." Fix the later one to match the previous. Signed-off-by: Slavomir Vlcek <svlc@inventati.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>