From 3a9f1a55eec9cc508abccda6a3fee795b812d66d Mon Sep 17 00:00:00 2001 From: Johannes Schindelin Date: Wed, 6 Dec 2006 13:27:40 +0100 Subject: [PATCH 1/8] cvs-migration document: make the need for "push" more obvious It really is an important concept to grasp for people coming from CVS. Even if it is briefly mentioned, it is not obvious enough to sink in. [jc: with wording updates from J. Bruce Fields] Signed-off-by: Johannes Schindelin Signed-off-by: Junio C Hamano --- Documentation/cvs-migration.txt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Documentation/cvs-migration.txt b/Documentation/cvs-migration.txt index 6812683a16..9c2a395e5a 100644 --- a/Documentation/cvs-migration.txt +++ b/Documentation/cvs-migration.txt @@ -24,6 +24,11 @@ First, note some ways that git differs from CVS: single shared repository which people can synchronize with; see below for details. + * Since every working tree contains a repository, a commit in your + private repository will not publish your changes; it will only create + a revision. You have to "push" your changes to a public repository to + make them visible to others. + Importing a CVS archive ----------------------- From 4003a58e415e5f51a3becac0079505b72299a7bc Mon Sep 17 00:00:00 2001 From: "J. Bruce Fields" Date: Wed, 6 Dec 2006 12:19:50 -0500 Subject: [PATCH 2/8] cvs-migration: improved section titles, better push/commit explanation Rename the section titles to make the "how-to" content of the section obvious. Also clarify that changes have to be commited before they can be pushed. Signed-off-by: Junio C Hamano --- Documentation/cvs-migration.txt | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/Documentation/cvs-migration.txt b/Documentation/cvs-migration.txt index 9c2a395e5a..a436180dd4 100644 --- a/Documentation/cvs-migration.txt +++ b/Documentation/cvs-migration.txt @@ -81,8 +81,8 @@ variants of this model. With a small group, developers may just pull changes from each other's repositories without the need for a central maintainer. -Emulating the CVS Development Model ------------------------------------ +Creating a Shared Repository +---------------------------- Start with an ordinary git working directory containing the project, and remove the checked-out files, keeping just the bare .git directory: @@ -110,7 +110,10 @@ $ GIT_DIR=repo.git git repo-config core.sharedrepository true Make sure committers have a umask of at most 027, so that the directories they create are writable and searchable by other group members. -Suppose this repository is now set up in /pub/repo.git on the host +Performing Development on a Shared Repository +--------------------------------------------- + +Suppose a repository is now set up in /pub/repo.git on the host foo.com. Then as an individual committer you can clone the shared repository: @@ -139,15 +142,17 @@ Pull: master:origin ------------ ================================ -You can update the shared repository with your changes using: +You can update the shared repository with your changes by first commiting +your changes, and then using: ------------------------------------------------ $ git push origin master ------------------------------------------------ -If someone else has updated the repository more recently, `git push`, like -`cvs commit`, will complain, in which case you must pull any changes -before attempting the push again. +to "push" those commits to the shared repository. If someone else has +updated the repository more recently, `git push`, like `cvs commit`, will +complain, in which case you must pull any changes before attempting the +push again. In the `git push` command above we specify the name of the remote branch to update (`master`). If we leave that out, `git push` tries to update From 49ed2bc4660c7cd0592cf21cc514080574d06320 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Mon, 4 Dec 2006 19:44:40 -0800 Subject: [PATCH 3/8] git-reset to remove "$GIT_DIR/MERGE_MSG" An earlier commit a9cb3c6e changed git-commit to use the contents of MERGE_MSG even when we do not have MERGE_HEAD (the rationale is in its log message). However, the change tricks the following sequence to include a merge message in a completely unrelated commit: $ git pull somewhere : oops, the conflicts are too much. forget it. $ git reset --hard : work work work $ git commit To fix this confusion, this patch makes "git reset" to remove the leftover MERGE_MSG that was prepared when the user abandoned the merge. Signed-off-by: Junio C Hamano Acked-by: Luben Tuikov Date: Wed, 6 Dec 2006 10:52:04 -0800 Subject: [PATCH 4/8] git-merge: squelch needless error message. While deciding if the new style command line argument is a tag or a branch, we checked it with "git show-ref -s --verify" to see if results in an error, but when it is not a branch, the check leaked the error message out, which was not needed to be shown to the end user. Signed-off-by: Junio C Hamano --- git-merge.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/git-merge.sh b/git-merge.sh index 272f004622..efdbabf775 100755 --- a/git-merge.sh +++ b/git-merge.sh @@ -189,7 +189,7 @@ else merge_name=$(for remote do rh=$(git-rev-parse --verify "$remote"^0 2>/dev/null) && - bh=$(git show-ref -s --verify "refs/heads/$remote") && + bh=$(git show-ref -s --verify "refs/heads/$remote" 2>/dev/null) && if test "$rh" = "$bh" then echo "$rh branch '$remote' of ." From 5a4cf3346d6c37007a7f5f94697868a5b2f2fa29 Mon Sep 17 00:00:00 2001 From: Jakub Narebski Date: Mon, 4 Dec 2006 23:47:22 +0100 Subject: [PATCH 5/8] gitweb: Allow PNG, GIF, JPEG images to be displayed in "blob" view Allow images in one of web formats (PNG, GIF, JPEG) - actually files with mimetype of image/png, image/git, image/jpeg - to be displayed in "blob" view using element, instead of using "blob_plain" view for them, like for all other files except also text/* mimetype files. This makes possible to easily go to file history, to HEAD version of the file, to appropriate commit etc; all of those are not available in "blob_plain" (raw) view. Only text files can have "blame" view link in the formats part of navbar. Signed-off-by: Jakub Narebski Signed-off-by: Junio C Hamano --- gitweb/gitweb.perl | 30 ++++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl index ffe8ce13ff..61e2ab2900 100755 --- a/gitweb/gitweb.perl +++ b/gitweb/gitweb.perl @@ -3229,10 +3229,13 @@ sub git_blob { open my $fd, "-|", git_cmd(), "cat-file", "blob", $hash or die_error(undef, "Couldn't cat $file_name, $hash"); my $mimetype = blob_mimetype($fd, $file_name); - if ($mimetype !~ m/^text\//) { + if ($mimetype !~ m!^(?:text/|image/(?:gif|png|jpeg)$)!) { close $fd; return git_blob_plain($mimetype); } + # we can have blame only for text/* mimetype + $have_blame &&= ($mimetype =~ m!^text/!); + git_header_html(undef, $expires); my $formats_nav = ''; if (defined $hash_base && (my %co = parse_commit($hash_base))) { @@ -3269,13 +3272,24 @@ sub git_blob { } git_print_page_path($file_name, "blob", $hash_base); print "
\n"; - my $nr; - while (my $line = <$fd>) { - chomp $line; - $nr++; - $line = untabify($line); - printf "
%4i %s
\n", - $nr, $nr, $nr, esc_html($line, -nbsp=>1); + if ($mimetype =~ m!^text/!) { + my $nr; + while (my $line = <$fd>) { + chomp $line; + $nr++; + $line = untabify($line); + printf "
%4i %s
\n", + $nr, $nr, $nr, esc_html($line, -nbsp=>1); + } + } elsif ($mimetype =~ m!^image/!) { + print qq!$file_name$hash, + hash_base=>$hash_base, file_name=>$file_name) . + qq!" />\n!; } close $fd or print "Reading blob failed.\n"; From ebdf7b952215946eff863e4da28f924178acea4f Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Mon, 4 Dec 2006 00:51:16 -0800 Subject: [PATCH 6/8] git-svn: avoid network timeouts for long-running fetches Long-running fetches run inside children to avoid memory leaks. When we refork, the connection in the parent can be idle for a long time; attempting to reuse it in the next child can result in timeouts. Signed-off-by: Eric Wong Signed-off-by: Junio C Hamano --- git-svn.perl | 1 + 1 file changed, 1 insertion(+) diff --git a/git-svn.perl b/git-svn.perl index d0bd0bdeb8..747daf0181 100755 --- a/git-svn.perl +++ b/git-svn.perl @@ -459,6 +459,7 @@ sub fetch_lib { $min = $max + 1; $max += $inc; $max = $head if ($max > $head); + $SVN = libsvn_connect($SVN_URL); } restore_index($index); return { revision => $last_rev, commit => $last_commit }; From de51faf3888505fa3d661d4c35f32ecaf9fa1087 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Wed, 6 Dec 2006 11:22:55 -0800 Subject: [PATCH 7/8] git-merge: fix "fix confusion between tag and branch" for real An earlier commit 3683dc5a broke the merge message generation with a careless use of && where it was not needed, breaking the merge message for cases where non branches are given. Signed-off-by: Junio C Hamano --- git-merge.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/git-merge.sh b/git-merge.sh index efdbabf775..a948878b91 100755 --- a/git-merge.sh +++ b/git-merge.sh @@ -188,8 +188,9 @@ else # in this loop. merge_name=$(for remote do - rh=$(git-rev-parse --verify "$remote"^0 2>/dev/null) && - bh=$(git show-ref -s --verify "refs/heads/$remote" 2>/dev/null) && + rh=$(git-rev-parse --verify "$remote"^0 2>/dev/null) || + continue ;# not something we can merge + bh=$(git show-ref -s --verify "refs/heads/$remote" 2>/dev/null) if test "$rh" = "$bh" then echo "$rh branch '$remote' of ." From 955289bf92f0513377763c9aacfe426d5151b05a Mon Sep 17 00:00:00 2001 From: Andy Parkins Date: Wed, 6 Dec 2006 12:07:23 +0000 Subject: [PATCH 8/8] Explicitly add the default "git pull" behaviour to .git/config on clone Without any specification in the .git/config file, git-pull will execute "git-pull origin"; which in turn defaults to pull from the first "pull" definition for the remote, "origin". This is a difficult set of defaults to track for a new user, and it's difficult to see what tells git to do this (especially when it is actually hard-coded behaviour). To ameliorate this slightly, this patch explicitly specifies the default behaviour during a clone using the "branch" section of the config. For example, a clone of a typical repository would create a .git/config containing: [remote "origin"] url = proto://host/repo.git fetch = refs/heads/master:refs/remotes/origin/master [branch "master"] remote = origin merge = refs/heads/master The [branch "master"] section is such that there is no change to the functionality of git-pull, but that functionality is now explicitly documented. Signed-off-by: Andy Parkins --- git-clone.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/git-clone.sh b/git-clone.sh index 0ace989fde..1f5d07a057 100755 --- a/git-clone.sh +++ b/git-clone.sh @@ -400,7 +400,9 @@ then rm -f "refs/remotes/$origin/HEAD" git-symbolic-ref "refs/remotes/$origin/HEAD" \ "refs/remotes/$origin/$head_points_at" - esac + esac && + git-repo-config branch."$head_points_at".remote "$origin" && + git-repo-config branch."$head_points_at".merge "refs/heads/$head_points_at" esac case "$no_checkout" in