path: root/contrib/examples
AgeCommit message (Collapse)Author
2010-08-18merge script: --ff-only to disallow true mergeJonathan Nieder
Port v1.6.6-rc0~62^2 (Teach 'git merge' and 'git pull' the option --ff-only, 2009-10-29) to the old merge script. Signed-off-by: Jonathan Nieder <> Signed-off-by: Junio C Hamano <>
2010-08-18merge script: handle many-way octopusJonathan Nieder
Based on v1.6.0-rc0~51^2~5 (Build in merge, 2008-07-07). Signed-off-by: Jonathan Nieder <> Signed-off-by: Junio C Hamano <>
2010-08-18merge script: handle -m --log correctlyJonathan Nieder
Based on v1.7.1.1~23^2 (merge: --log appends shortlog to message if specified, 2010-05-11). Without this change, the scripted (non-builtin) merge does not pass t7604. Cc: Tay Ray Chuan <> Signed-off-by: Jonathan Nieder <> Signed-off-by: Junio C Hamano <>
2010-08-18merge script: forbid merge -s indexJonathan Nieder
Some git-merge-* commands are not merge strategies. This is based on v1.6.1-rc1~294^2~7 (builtin-merge: allow using a custom strategy, 2008-07-30) but it is less smart: we just use a hard-coded list of forbidden strategy names. It is okay if this falls out of date, since the code is just an example. Signed-off-by: Jonathan Nieder <> Signed-off-by: Junio C Hamano <>
2010-08-18merge script: allow custom strategiesJonathan Nieder
The idea comes from v1.6.1-rc1~294^2~7 (builtin-merge: allow using a custom strategy, 2008-07-30). Signed-off-by: Jonathan Nieder <> Signed-off-by: Junio C Hamano <>
2010-08-18merge script: merge -X<option>Jonathan Nieder
Without this support, the scripted merge cannot pass t6037. Based on v1.7.0-rc0~55^2~5 (git merge -X<option>, 2009-11-25). Signed-off-by: Jonathan Nieder <> Signed-off-by: Junio C Hamano <>
2010-08-18merge script: improve log message subjectJonathan Nieder
- point out remote-tracking branches as "remote branch 'upstream/master'"; - avoid misleading log messages when a tag and branch share a name. This approximates the builtin merge command's behavior well enough to pass the relevant tests. Based roughly on v1.6.4.2~10^2 (merge: indicate remote tracking branches in merge message, 2009-08-09) and v1.6.4.2~10^2~1 (merge: fix incorrect merge message for ambiguous tag/branch, 2009-08-09). Cc: Jeff King <> Signed-off-by: Jonathan Nieder <> Signed-off-by: Junio C Hamano <>
2010-08-18merge script: refuse to merge during mergeJonathan Nieder
Check MERGE_HEAD and bail out if it exists. Based on v1.6.3.3~3^2 (refuse to merge during a merge, 2009-06-01). Without this change, the scripted merge does not pass t3030. Cc: Clemens Buchacher <> Signed-off-by: Jonathan Nieder <> Signed-off-by: Junio C Hamano <>
2010-08-18merge script: tweak unmerged files message to match builtinJonathan Nieder
Before: You are in the middle of a conflicted merge. After: Merge is not possible because you have unmerged files. I prefer the old message, but the new one is more consistent with other commands and tests expect it. In particular, without this change the scripted merge does not pass t3030. Based on v1.7.0-rc0~66^2 (Be more user-friendly when refusing to do something because of conflict., 2010-01-12). Cc: Matthieu Moy <> Signed-off-by: Jonathan Nieder <> Signed-off-by: Junio C Hamano <>
2010-08-18merge script: --squash, --ff from unborn branch are errorsJonathan Nieder
Port v1.6.1-rc1~319 (provide more errors for the "merge into empty head" case, 2008-08-21) to the example merge script. Noticed by comparison with builtin merge. Signed-off-by: Jonathan Nieder <> Signed-off-by: Junio C Hamano <>
2010-04-19Honor "tagopt = --tags" configuration optionSamuel Tardieu
If the "tagopt = --tags" option of a remote is set, all tags will be fetched as in "git fetch --tags". Signed-off-by: Samuel Tardieu <> Signed-off-by: Junio C Hamano <>
2010-02-14Builtin-ify git-notesJohan Herland
The builtin-ification includes some minor behavioural changes to the command-line interface: It is no longer allowed to mix the -m and -F arguments, and it is not allowed to use multiple -F options. As part of the builtin-ification, we add the commit_notes() function to the builtin API. This function (together with the notes.h API) can be easily used from other builtins to manipulate the notes tree. Also includes needed changes to t3301. This patch has been improved by the following contributions: - Stephen Boyd: Use die() instead of fprintf(stderr, ...) followed by exit(1) Cc: Stephen Boyd <> Signed-off-by: Johan Herland <> Signed-off-by: Junio C Hamano <>
2010-01-18git merge -X<option>Avery Pennarun
Teach "-X <option>" command line argument to "git merge" that is passed to strategy implementations. "ours" and "theirs" autoresolution introduced by the previous commit can be asked to the recursive strategy. Signed-off-by: Avery Pennarun <> Signed-off-by: Junio C Hamano <>
2009-11-21Merge branch 'jn/help-everywhere'Junio C Hamano
* jn/help-everywhere: (23 commits) diff --no-index: make the usage string less scary merge-{recursive,subtree}: use usagef() to print usage Introduce usagef() that takes a printf-style format Let 'git <command> -h' show usage without a git dir Show usage string for 'git http-push -h' Let 'git http-fetch -h' show usage outside any git repository Show usage string for 'git stripspace -h' Show usage string for 'git unpack-file -h' Show usage string for 'git show-index -h' Show usage string for 'git rev-parse -h' Show usage string for 'git merge-one-file -h' Show usage string for 'git mailsplit -h' Show usage string for 'git imap-send -h' Show usage string for 'git get-tar-commit-id -h' Show usage string for 'git fast-import -h' Show usage string for 'git check-ref-format -h' http-fetch: add missing initialization of argv0_path Show usage string for 'git show-ref -h' Show usage string for 'git merge-ours -h' Show usage string for 'git commit-tree -h' ... Conflicts: imap-send.c
2009-11-10Retire fetch--tool helper to contrib/examplesJonathan Nieder
When git-fetch was builtin-ized, the previous script was moved to contrib/examples. Now, it is the sole remaining user for 'git fetch--tool'. The fetch--tool code is still worth keeping around so people can try out the old, for example when investigating regressions from the builtinifaction. Signed-off-by: Jonathan Nieder <> Signed-off-by: Junio C Hamano <>
2009-10-25Use 'fast-forward' all over the placeFelipe Contreras
It's a compound word. Signed-off-by: Felipe Contreras <> Signed-off-by: Junio C Hamano <>
2009-02-25Fix typo in contrib/examples/git-svnimport.txtMichael J Gruber
Signed-off-by: Michael J Gruber <> Signed-off-by: Junio C Hamano <>
2009-02-25Convert git-* invocations to "git *" in the svnimport example.Abhijit Menon-Sen
After these changes, git-svnimport worked fine for me. Signed-off-by: Abhijit Menon-Sen <> Signed-off-by: Junio C Hamano <>
2009-01-13contrib/examples/README: give an explanation of the status of these
We attempt to give an explanation of the status of the files in this directory. Signed-off-by: jidanni <> Signed-off-by: Junio C Hamano <>
2008-10-16Typo "does not exists" when git remote update remote.Mikael Magnusson
2008-07-30Replace uses of "git-var" with "git var"Todd Zullinger
Signed-off-by: Todd Zullinger <> Signed-off-by: Junio C Hamano <>
2008-07-23svnimport: newer libsvn wants us to ask for the root with "", not "/"P. Christeas
In r27729, libsvn introduced an assert which explicitly forbids searching the tree at "/". Luckily enough, it still accepts an empty string "" as the starting point. Tested against libsvn0-1.5.0-4mdv2009.0 (needs the fix), libsvn0-1.4.6-5mdv2008.1 (works anyway) Signed-off-by: P. Christeas <> Signed-off-by: Junio C Hamano <>
2008-07-17Merge branch 'sb/dashless'Junio C Hamano
* sb/dashless: Make usage strings dash-less t/: Use "test_must_fail git" instead of "! git" t/ exit with small negagive int is ok with test_must_fail Conflicts: builtin-blame.c builtin-mailinfo.c builtin-mailsplit.c builtin-shortlog.c t/ t/
2008-07-16Merge branch 'mv/merge-in-c'Junio C Hamano
* mv/merge-in-c: reduce_heads(): protect from duplicate input reduce_heads(): thinkofix Add a new test for git-merge-resolve t6021: add a new test for git-merge-resolve Teach merge.log to "git-merge" again Build in merge Fix on AIX git-commit-tree: make it usable from other builtins Add new test case to ensure git-merge prepends the custom merge message Add new test case to ensure git-merge reduces octopus parents when possible Introduce reduce_heads() Introduce get_merge_bases_many() Add new test to ensure git-merge handles more than 25 refs. Introduce get_octopus_merge_bases() in commit.c git-fmt-merge-msg: make it usable from other builtins Move read_cache_unmerged() to read-cache.c Add new test to ensure git-merge handles pull.twohead and pull.octopus Move parse-options's skip_prefix() to git-compat-util.h Move commit_list_count() to commit.c Move split_cmdline() to alias.c Conflicts: Makefile parse-options.c Add remote_refs() git-ls-remote frontendPetr Baudis
This patch also converts the good ole' git-remote.perl to use it. It is otherwise used in the machinery and I guess other scripts might find it useful too. Unfortunately, git-ls-remote --heads . is subtly different from git-ls-remote . refs/heads/ (since the second matches anywhere in the string, not just at the beginning) so we have to provide interface for both. Signed-off-by: Petr Baudis <> Signed-off-by: Junio C Hamano <>
2008-07-08Build in mergeMiklos Vajna
Mentored-by: Johannes Schindelin <> Signed-off-by: Miklos Vajna <> Signed-off-by: Junio C Hamano <>
2008-05-25Merge branch 'db/clone-in-c'Junio C Hamano
* db/clone-in-c: Add test for cloning with "--reference" repo being a subset of source repo Add a test for another combination of --reference Test that --reference actually suppresses fetching referenced objects clone: fall back to copying if hardlinking fails builtin-clone.c: Need to closedir() in copy_or_link_directory() builtin-clone: fix initial checkout Build in clone Provide API access to init_db() Add a function to set a non-default work tree Allow for having for_each_ref() list extra refs Have a constant extern refspec for "--tags" Add a library function to add an alternate to the alternates file Add a lockfile function to append to a file Mark the list of refs to fetch as const Conflicts: cache.h t/
2008-05-05Build in cloneDaniel Barkalow
Thanks to Johannes Schindelin for various comments and improvements, including supporting cloning full bundles. Signed-off-by: Junio C Hamano <>
2008-03-16Resurrect git-rerere to contrib/examplesJunio C Hamano
It is handy to have a copy readily available for checking regressions. Signed-off-by: Junio C Hamano <>
2008-03-12Merge branch 'js/remote'Junio C Hamano
* js/remote: "remote update": print remote name being fetched from builtin remote rm: remove symbolic refs, too remote: fix "update [group...]" remote show: Clean up connection correctly if object fetch wasn't done builtin-remote: prune remotes correctly that were added with --mirror Make git-remote a builtin Test "git remote show" and "git remote prune" parseopt: add flag to stop on first non option path-list: add functions to work with unsorted lists Conflicts: parse-options.c
2008-03-01Make git-remote a builtinJohannes Schindelin
Signed-off-by: Johannes Schindelin <> Signed-off-by: Junio C Hamano <>
2008-02-27Merge branch 'db/checkout'Junio C Hamano
* db/checkout: (21 commits) checkout: error out when index is unmerged even with -m checkout: show progress when checkout takes long time while switching branches Add merge-subtree back checkout: updates to tracking report builtin-checkout.c: Remove unused prefix arguments in switch_branches path checkout: work from a subdirectory checkout: tone down the "forked status" diagnostic messages Clean up reporting differences on branch switch builtin-checkout.c: fix possible usage segfault checkout: notice when the switched branch is behind or forked Build in checkout Move code to clean up after a branch change to branch.c Library function to check for unmerged index entries Use diff -u instead of diff in t7201 Move create_branch into a library file Build-in merge-recursive Add "skip_unmerged" option to unpack_trees. Discard "deleted" cache entries after using them to update the working tree Send unpack-trees debugging output to stderr Add flag to make unpack_trees() not print errors. ... Conflicts: Makefile
2008-02-16Build in checkoutDaniel Barkalow
The only differences in behavior should be: - git checkout -m with non-trivial merging won't print out merge-recursive messages (see the change in - git checkout -- paths... will give a sensible error message if HEAD is invalid as a commit. - some intermediate states which were written to disk in the shell version (in particular, index states) are only kept in memory in this version, and therefore these can no longer be revealed by later write operations becoming impossible. - when we change branches, we discard MERGE_MSG, SQUASH_MSG, and rr-cache/MERGE_RR, like reset always has. I'm not 100% sure I got the merge recursive setup exactly right; the base for a non-trivial merge in the shell code doesn't seem theoretically justified to me, but I tried to match it anyway, and the tests all pass this way. Other than these items, the results should be identical to the shell version, so far as I can tell. [jc: squashed lock-file fix from Dscho in] Signed-off-by: Daniel Barkalow <> Signed-off-by: Johannes Schindelin <> Signed-off-by: Junio C Hamano <>
2008-01-18Officially deprecate repo-config.Junio C Hamano
Signed-off-by: Junio C Hamano <>
2007-12-27contrib: resurrect scripted git-revert.Junio C Hamano
Signed-off-by: Junio C Hamano <>
2007-12-05Merge branch 'kh/commit'Junio C Hamano
* kh/commit: (33 commits) git-commit --allow-empty git-commit: Allow to amend a merge commit that does not change the tree quote_path: fix collapsing of relative paths Make git status usage say git status instead of git commit Fix --signoff in builtin-commit differently. git-commit: clean up die messages Do not generate full commit log message if it is not going to be used Remove git-status from list of scripts as it is builtin Fix off-by-one error when truncating the diff out of the commit message. builtin-commit.c: export GIT_INDEX_FILE for launch_editor as well. Add a few more tests for git-commit builtin-commit: Include the diff in the commit message when verbose. builtin-commit: fix partial-commit support Fix add_files_to_cache() to take pathspec, not user specified list of files Export three helper functions from ls-files builtin-commit: run commit-msg hook with correct message file builtin-commit: do not color status output shown in the message template file_exists(): dangling symlinks do exist Replace "runstatus" with "status" in the tests t7501-commit: Add test for git commit <file> with dirty index. ...
2007-11-29Merge branch 'maint'Junio C Hamano
* maint: scripts: do not get confused with HEAD in work tree Improve description of git-branch -d and -D in man page.
2007-11-25Merge branch 'jk/send-pack'Junio C Hamano
* jk/send-pack: (24 commits) send-pack: cluster ref status reporting send-pack: fix "everything up-to-date" message send-pack: tighten remote error reporting make "find_ref_by_name" a public function Fix warning about bitfield in struct ref send-pack: assign remote errors to each ref send-pack: check ref->status before updating tracking refs send-pack: track errors for each ref git-push: add documentation for the newly added --mirror mode Add tests for git push'es mirror mode Update the tracking references only if they were succesfully updated on remote Add a test checking if send-pack updated local tracking branches correctly git-push: plumb in --mirror mode Teach send-pack a mirror mode send-pack: segfault fix on forced push Reteach builtin-ls-remote to understand remotes send-pack: require --verbose to show update of tracking refs receive-pack: don't mention successful updates more terse push output Build in ls-remote ...
2007-11-25Merge branch 'sb/clean'Junio C Hamano
* sb/clean: Teach git clean to use setup_standard_excludes() git-clean: Fix error message if clean.requireForce is not set. Make git-clean a builtin
2007-11-23Port git commit to C.Kristian Høgsberg
This makes git commit a builtin and moves to contrib/examples. This also removes the git-runstatus helper, which was mostly just a implementation detail. Signed-off-by: Kristian Høgsberg <> Signed-off-by: Junio C Hamano <>
2007-11-22git-merge-ours: make it a builtin.Thomas Harning
Except that this fixes a longstanding corner case bug by tightening the way underlying diff-index command is run, it is functionally equivalent to the scripted version. Signed-off-by: Thomas Harning Jr <> Signed-off-by: Junio C Hamano <>
2007-11-19Make git-clean a builtinShawn Bohrer
This replaces with builtin-clean.c, and moves to the examples. This also introduces a change in behavior when removing directories explicitly specified as a path. For example currently: 1. When dir has only untracked files, these two behave differently: $ git clean -n dir $ git clean -n dir/ the former says "Would not remove dir/", while the latter would say "Would remove dir/untracked" for all paths under it, but not the directory itself. With -d, the former would stop refusing, however since the user explicitly asked to remove the directory the -d is no longer required. 2. When there are more parameters: $ git clean -n dir foo $ git clean -n dir/ foo both cases refuse to remove dir/ unless -d is specified. Once again since both cases requested to remove dir the -d is no longer required. Thanks to Johannes Schindelin for the conversion to using the parse-options API. Signed-off-by: Shawn Bohrer <> Signed-off-by: Junio C Hamano <>
2007-11-05Build in ls-remoteDaniel Barkalow
This actually replaces peek-remote with ls-remote, since peek-remote now handles everything. peek-remote remains an a second name for ls-remote, although its help message now gives the "ls-remote" name. Signed-off-by: Daniel Barkalow <> Signed-off-by: Junio C Hamano <>
2007-10-31No longer install git-svnimport, move to contrib/examplesGerrit Pape
This has been proposed for a few times without much reaction from the list. Actually remove it to see who screams. Signed-off-by: Gerrit Pape <> Signed-off-by: Junio C Hamano <>
2007-10-16Merge branch 'master' into db/fetch-packShawn O. Pearce
There's a number of tricky conflicts between master and this topic right now due to the rewrite of builtin-push. Junio must have handled these via rerere; I'd rather not deal with them again so I'm pre-merging master into the topic. Besides this topic somehow started to depend on the strbuf series that was in next, but is now in master. It no longer compiles on its own without the strbuf API. * master: (184 commits) Whip post maintenance series into shape. Minor usage update in setgitperms.perl manual: use 'URL' instead of 'url'. manual: add some markup. manual: Fix example finding commits referencing given content. Fix wording in push definition. Fix some typos, punctuation, missing words, minor markup. manual: Fix or remove em dashes. Add a --dry-run option to git-push. Add a --dry-run option to git-send-pack. Fix in-place editing functions in convert.c instaweb: support for Ruby's WEBrick server instaweb: allow for use of auto-generated scripts Add 'git-p4 commit' as an alias for 'git-p4 submit' hg-to-git speedup through selectable repack intervals git-svn: respect Subversion's [auth] section configuration values gtksourceview2 support for gitview fix contrib/hooks/post-receive-email hooks.recipients error message Support cvs via git-shell rebase -i: use diff plumbing instead of porcelain ... Conflicts: Makefile builtin-push.c rsh.c
2007-09-24Merge branch 'maint'Junio C Hamano
* maint: git-svn: don't attempt to spawn pager if we don't want one Supplant the "while case ... break ;; esac" idiom User Manual: add a chapter for submodules user-manual: don't assume refs are stored under .git/refs Detect exec bit in more cases. Conjugate "search" correctly in the git-prune-packed man page. Move the paragraph specifying where the .idx and .pack files should be Documentation/git-lost-found.txt: drop unnecessarily duplicated name.
2007-09-23Supplant the "while case ... break ;; esac" idiomDavid Kastrup
A lot of shell scripts contained stuff starting with while case "$#" in 0) break ;; esac and similar. I consider breaking out of the condition instead of the body od the loop ugly, and the implied "true" value of the non-matching case is not really obvious to humans at first glance. It happens not to be obvious to some BSD shells, either, but that's because they are not POSIX-compliant. In most cases, this has been replaced by a straight condition using "test". "case" has the advantage of being faster than "test" on vintage shells where "test" is not a builtin. Since none of them is likely to run the git scripts, anyway, the added readability should be worth the change. A few loops have had their termination condition expressed differently. Signed-off-by: David Kastrup <> Signed-off-by: Junio C Hamano <>
2007-09-19Make fetch a builtinDaniel Barkalow
Thanks to Johannes Schindelin for review and fixes, and Julian Phillips for the original C translation. This changes a few small bits of behavior: branch.<name>.merge is parsed as if it were the lhs of a fetch refspec, and does not have to exactly match the actual lhs of a refspec, so long as it is a valid abbreviation for the same ref. branch.<name>.merge is no longer ignored if the remote is configured with a branches/* file. Neither behavior is useful, because there can only be one ref that gets fetched, but this is more consistant. Also, fetch prints different information to standard out. Signed-off-by: Daniel Barkalow <> Signed-off-by: Junio C Hamano <>
2007-09-12Make "git reset" a builtin.Carlos Rica
This replaces the script "" with "builtin-reset.c". A few git commands used in the script are called from the builtin also: "ls-files" to check for unmerged files, "read-tree" for resetting the index file in "mixed" and "hard" resets, and "update-index" to refresh at the end in the "mixed" reset and also for the option that gets selected paths into the index. The reset option with paths was implemented by Johannes Schindelin. Since the option that gets selected paths into the index is not a "reset" like the others because it does not change the HEAD at all, now the command is showing a warning when the "--mixed" option is supplied for that purpose. The following table shows the behaviour of "git reset" for the different supported options, where X means "changing" the HEAD, index or working tree: reset: --soft --mixed --hard -- <paths> HEAD X X X - index - X X X files - - X - Signed-off-by: Carlos Rica <> Signed-off-by: Junio C Hamano <>
2007-07-27Make verify-tag a builtin.Carlos Rica
This replaces "" with "builtin-verify-tag.c". Testing relies on the "git tag -v" tests calling this command. A temporary file is needed when calling to gpg, because git is already creating detached signatures (gpg option -b) to sign tags (instead of leaving gpg to add the signature to the file by itself), and those signatures need to be supplied in a separate file to be verified by gpg. The program uses git_mkstemp to create that temporary file needed by gpg, instead of the previously used "$GIT_DIR/.tmp-vtag", in order to allow the command to be used in read-only repositories, and also prevent other instances of git to read or remove the same file. Signal SIGPIPE is ignored because the program sometimes was terminated because that signal when writing the input for gpg. The command now can receive many tag names to be verified. Documentation is also updated here to reflect this new behaviour. Signed-off-by: Carlos Rica <> Signed-off-by: Junio C Hamano <>