Git development
 help / color / mirror / Atom feed
* Re: On git 1.6 (novice's opinion)
From: demerphq @ 2009-03-28 10:33 UTC (permalink / raw)
  To: Ulrich Windl; +Cc: Michael J Gruber, git
In-Reply-To: <49CCE72E.20081.258EE61F@Ulrich.Windl.rkdvmks1.ngate.uni-regensburg.de>

2009/3/27 Ulrich Windl <ulrich.windl@rz.uni-regensburg.de>:
> On 27 Mar 2009 at 13:49, Michael J Gruber wrote:
>
>> Ulrich Windl venit, vidit, dixit 27.03.2009 08:21:
>
> [...]
>
>> Keyword substitution and cvs/svn style version numbers are independent
>> issues. The sha1 describes a commit uniquely, one could use that as a
>> keyword.
>
> However version numbers and time stamps have the property of being at least
> partially ordered in respect of "newer/older". That property does not hold for
> SHA-1 checksums. Just imagine suggesting users to upgrade from Microsoft
> Word/004765c2a1e9771e886f0dbe87d4f89643cd6f70 to Microsoft
> Word/00b7e6f51130f234a969c84ee9231a5ff7fc8a82 ;-)

The problem here is that in some "version control" systems the concept
of "release version" has been conflated with "version control system
revision number".

They arent the same thing, never were, and conflating the two only
caused and causes trouble.

A "release version" is a *tag*, always has been or should have been
really, and in git is in fact.

Cheers,
yves



-- 
perl -Mre=debug -e "/just|another|perl|hacker/"

^ permalink raw reply

* Re: How do I force git to forget about merging a binary file that is to  stay deleted on the target branch?
From: Nanako Shiraishi @ 2009-03-28 10:23 UTC (permalink / raw)
  To: Brent Goodrick; +Cc: git
In-Reply-To: <e38bce640903272226l3facf47br9b1849bf708c3881@mail.gmail.com>

Quoting Brent Goodrick <bgoodr@gmail.com>:

> How do I commit a merge but force git to forget about merging one file
> that I don't want on the target branch, when it is binary, and when it
> was changed on the source branch, but was deleted on the target branch
> (and should stay deleted on the target branch)?

I think the standard answer is "you don't".

Instead of using only two branches ('home' and 'work'), you use one common branch (perhaps 'master') that is meant to hold the changes and files that are sharable between two places, and maintain two branches ('home' and 'work') that are forked from the common branch. You treat them as if they are release branches and employ the "Never merging back" workflow (see gitster's journal around middle of January this year).

At home (or at work), you record your changes that are also relevant to the other place to the common branch ('master'), and you record changes that are specific to the location to either 'home' or 'work'. And merge 'master' to 'home' and 'work' as necessary, but never merge 'home' nor 'work' to anything else.

-- 
Nanako Shiraishi
http://ivory.ap.teacup.com/nanako3/

^ permalink raw reply

* [Announce] teamgit v0.0.10 - visual mergetool
From: Abhijit Bhopatkar @ 2009-03-28  9:53 UTC (permalink / raw)
  To: git

Hi people,
teamGit is a functional git gui written in qt, its ultimate aim is to
add functionality on top of git targeted at small closely knit teams.

I have tagged the repo with v0.0.10!!!
You can now get the .deb from ubuntu intrepid ppa
deb http://ppa.launchpad.net/bain-devslashzero/ubuntu intrepid main
package name is teamgit.
The main project website is http://www.devslashzero.com/teamgit

Changes from v0.0.9 include a visual interactive merge conflict
resolution.

Changelog from v0.0.9 follows
Abhijit Bhopatkar (32):
      Revert "Check, whether valid data is parseable or not"
      guifycommanddialogimpl.cpp: Avoid crashing for unparsable man
pages
      gitprocess: whitespace cleanup
      Add slot to check for merge conflicts
      Add merge conflict label
      Add merge conflict checking in refresh
      settings_ui: Add mergetool path text box and select button
      Move git specific settings from mainwindow to settings for easier
management
      Add merge tool path setting
      Add mergetool selction and fix writing it to settings file
      whitespace fixes
      Fix merge conflict label
      Merge branch 'master' of git://gitorious.org/teamgit/mainline
      Show files with merge conflicts only once
      Move GIT_INVOKE from mainwindowsimpl to gitthread
      Added merge dialog ui file
      Added merge dialog implementation
      Added merge dialog file to the qmake project
      Execute merge dialog when merge conflict label is clicked
      Connect filediff signal from git thread to mergedialog
      Show conflicting files in the merge dialog
      Added slot for getting merge conflict file's contents
      Gather conflicting file contents for unmerged files
      Disable merge tool options group box
      Fix: Clear previous contents in merge dialog on init
      gitprocess: append the filename to the conflict contents signal
      Disable the mergetool settings
      mergedialog: execute meld to resolve merge conflict
      Set commit message in commit dialog if COMMIT_EDITMSG exists
      diffviewer: Move font setting from mainwindowimpl to diffviewer
      User .git/MERGE_MSG instead of COMMIT_EDITMSG
      Fix merege conflict message while commiting

Terje Rosten (1):
      fixing .desktop file

^ permalink raw reply

* Re: On git 1.6 (novice's opinion)
From: Dmitry Potapov @ 2009-03-28  9:53 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Ulrich Windl, H.Merijn Brand, git
In-Reply-To: <7v8wmq5t8d.fsf@gitster.siamese.dyndns.org>

On Sat, Mar 28, 2009 at 4:30 AM, Junio C Hamano <gitster@pobox.com> wrote:
> Dmitry Potapov <dpotapov@gmail.com> writes:
>
>> On Fri, Mar 27, 2009 at 12:50 PM, Ulrich Windl
>> <ulrich.windl@rz.uni-regensburg.de> wrote:
>>>
>>> what made me wonder is this (about item 1): I thought I've read that blobs store
>>> content and attributes, so very obviously I wondered why not store thr "right
>>> attributes" (i.e. the time of the file). My reasoning: You make some changes, then
>>> test them (which might last several hours or days). The if I'm happy I'll
>>> "commit".
>>
>> With Git, you usually commit your changes immediately (without waiting
>> the result
>> of testing), because you can always undo commit until you publish your changes.
>
> Heh, "can" and "usually" are somewhat different.  I don't.

Fair enough. But I was refering to the situation where testing may take
several hours or days. Leaving uncommitted changes in your working tree
for a few days is rarely a good idea if you can undo the commit later. Of
course, the situation is different if the testing takes only a couple minutes.

Dmitry

^ permalink raw reply

* Re: [RFC] Interactive difftool
From: Ping Yin @ 2009-03-28  9:14 UTC (permalink / raw)
  To: Jeff King; +Cc: David Aguilar, Git Mailing List
In-Reply-To: <20090328073253.GA9013@coredump.intra.peff.net>

On Sat, Mar 28, 2009 at 3:32 PM, Jeff King <peff@peff.net> wrote:
> On Fri, Mar 27, 2009 at 11:23:15PM +0800, Ping Yin wrote:
>
>> We can just change git-difftool.perl
>>
>> The easiest way is first parsing the output of git diff --stat,
>> adding the number at the beginning, for example
>> [1] diff.c                   |   10 +++++++++-
>> [2] t/t4020-diff-external.sh |    8 ++++++++
>
> I am not paying enough attention to this thread to comment on your
> overall goal, but instead of parsing "--stat", try "--numstat".
>

Thanks, that helps.

^ permalink raw reply

* Re: [PATCH] difftool: add a -y shortcut for --no-prompt
From: Junio C Hamano @ 2009-03-28  8:56 UTC (permalink / raw)
  To: David Aguilar; +Cc: git
In-Reply-To: <1237962599-29625-1-git-send-email-davvid@gmail.com>

David Aguilar <davvid@gmail.com> writes:

> This is another consistency cleanup to make git-difftool's options
> match git-mergetool.
> ...
> @@ -60,11 +60,11 @@ sub generate_command
>  			$ENV{GIT_DIFF_TOOL} = substr($arg, 7);
>  			next;
>  		}
> -		if ($arg eq '--no-prompt') {
> +		if ($arg eq '-y' || '--no-prompt') {

This was the typo that broke 'pu'; I fixed it up and re-queued the series.

^ permalink raw reply

* Re: First round of UGFWIINI results
From: Jeff King @ 2009-03-28  7:42 UTC (permalink / raw)
  To: Jakub Narebski; +Cc: Johannes Schindelin, git
In-Reply-To: <m37i2b2ecu.fsf@localhost.localdomain>

On Fri, Mar 27, 2009 at 08:08:04AM -0700, Jakub Narebski wrote:

> Not exactly UGFWIINI yet, but:
> 
>   "Music collaboration via git?"
>   http://www.37signals.com/svn/posts/1655-music-collaboration-via-git
>   (sharing LilyPond source files for music notation).

I do something similar, though I am usually not writing in lilypond but
rather in ABC or human-readable chord charts with accompanying lyrics.
However, my band-mates are not git-literate, so I usually end up pulling
their versions directly from email into the working tree, and then
committing to git myself.

For added UGFWIINI, I also keep multitrack recording projects in the
same repo. Live single tracks are kept as pristine "source", and then
are mixed down (with filters and effects added) into a final product.
It's even driven by make. ;)

However, the source files are annoyingly large to work with in git, so I
keep them outside of the repo as immutable source and refer to them by
unique name. Only the ways in which they are filtered or combined are in
the repo.

-Peff

^ permalink raw reply

* Re: [RFC] Interactive difftool
From: Jeff King @ 2009-03-28  7:32 UTC (permalink / raw)
  To: Ping Yin; +Cc: David Aguilar, Git Mailing List
In-Reply-To: <46dff0320903270823v5e8e9c80w506d8a85440588f5@mail.gmail.com>

On Fri, Mar 27, 2009 at 11:23:15PM +0800, Ping Yin wrote:

> We can just change git-difftool.perl
> 
> The easiest way is first parsing the output of git diff --stat,
> adding the number at the beginning, for example
> [1] diff.c                   |   10 +++++++++-
> [2] t/t4020-diff-external.sh |    8 ++++++++

I am not paying enough attention to this thread to comment on your
overall goal, but instead of parsing "--stat", try "--numstat".

-Peff

^ permalink raw reply

* Re: Git Download/Bootstrap Suggestion
From: Dilip M @ 2009-03-28  7:24 UTC (permalink / raw)
  To: Mike Gaffney, git
In-Reply-To: <49CD0841.9000602@gmail.com>

I had a same question :) what I want is to distribute a git version
across some team. I maintain a clone and keep the latest tag
checkedout. When ever there is a new release (tag), I switch to master
branch and pull. Than I checkout the new tag and compile.  Is there
any simple way to do this w/o any downtime?. There should be .... I
just miss some extra knowledge on git. Thanks in advance for
suggestions

     Dilip

On 3/27/09, Mike Gaffney <mr.gaffo@gmail.com> wrote:
> I may be missing something, but I would like to request that
> http://git-scm.com/download provide a link to a tarball of the actual
> git clone of the current repository with the repo parked on the latest
> stable. What I mean is that for most of my systems I build git off of
> source but I like to be able to just git pull when I want to update
> them. Currently what I have to do is
> - download the source tarball (or the rpm)
> - make it
> - install it
> - use that git clone the real repo
> - checkout the newest tag
> - make configure
> - configure
> - make
> - make install
>
> It'd be a lot cooler if I could just wget a full get repo on the latest
> tag :)
>
> Just a request, Thanks
>     -Mike
> --
> To unsubscribe from this list: send the line "unsubscribe git" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>

^ permalink raw reply

* Re: [PATCH 2/2] Resolve double chmod() in move_temp_to_file()
From: Junio C Hamano @ 2009-03-28  6:21 UTC (permalink / raw)
  To: Johan Herland; +Cc: Johannes Sixt, git
In-Reply-To: <200903261617.48362.johan@herland.net>

Johan Herland <johan@herland.net> writes:

> diff --git a/sha1_file.c b/sha1_file.c
> index 87ac53b..05af3c5 100644
> --- a/sha1_file.c
> +++ b/sha1_file.c
> @@ -2252,7 +2252,7 @@ int move_temp_to_file(const char *tmpfile, const char *filename)
>  		/* FIXME!!! Collision check here ? */
>  	}
>  
> -	if (chmod(filename, 0444) || adjust_shared_perm(filename))
> +	if (chmod(filename, get_shared_perm(0444)))

Your get_shared_perm() will end up feeding 0444 to S_ISDIR(), which would
most likely say "no" and cause real harm, but there is no guarantee that
we won't start checking S_ISREG() or other things in get_shared_perm()
later.  I do not like this.

How about doing it this way instead?

One thing to note is that we seem to have been passing what we read from
st.st_mode, together with S_IFMT bits, to chmod(2); I do not think I've
seen any breakage reports on exotic systems (glibc on Linux seems to
ignore the higher bits), but from my reading of POSIX, I would not be
surprised if somebody's chmod(2) returned EINVAL.

-- >8 --
set_shared_perm(): sometimes we know what the final mode bits should look like

adjust_shared_perm() first obtains the mode bits from lstat(2), expecting
to find what the result of applying user's umask is, and then tweaked it
as necessary.  When the file to be adjusted is created with mkstemp(3),
however, the mode thusly obtained does not have anything to do with usre's
umask, and we would need to start from 0444 in such a case and there is no
point running lstat(2) for such a path.

This introduces a new API set_shared_perm() to bypass the lstat(2) and
instead force setting the mode bits to the desired value directly.
adjust_shared_perm() becomes a thin wrapper to the function.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
 cache.h     |    3 ++-
 path.c      |   25 ++++++++++++++++---------
 sha1_file.c |    4 ++--
 3 files changed, 20 insertions(+), 12 deletions(-)

diff --git a/cache.h b/cache.h
index 189151d..e283bbe 100644
--- a/cache.h
+++ b/cache.h
@@ -613,7 +613,8 @@ enum sharedrepo {
 	PERM_EVERYBODY      = 0664,
 };
 int git_config_perm(const char *var, const char *value);
-int adjust_shared_perm(const char *path);
+int set_shared_perm(const char *path, int mode);
+#define adjust_shared_perm(path) set_shared_perm((path), 0)
 int safe_create_leading_directories(char *path);
 int safe_create_leading_directories_const(const char *path);
 char *enter_repo(char *path, int strict);
diff --git a/path.c b/path.c
index 42898e0..8a0a674 100644
--- a/path.c
+++ b/path.c
@@ -311,16 +311,23 @@ char *enter_repo(char *path, int strict)
 	return NULL;
 }
 
-int adjust_shared_perm(const char *path)
+int set_shared_perm(const char *path, int mode)
 {
 	struct stat st;
-	int mode, tweak, shared;
+	int tweak, shared, orig_mode;
 
-	if (!shared_repository)
+	if (!shared_repository) {
+		if (mode)
+			return chmod(path, mode & ~S_IFMT);
 		return 0;
-	if (lstat(path, &st) < 0)
-		return -1;
-	mode = st.st_mode;
+	}
+	if (!mode) {
+		if (lstat(path, &st) < 0)
+			return -1;
+		mode = st.st_mode;
+		orig_mode = mode;
+	} else
+		orig_mode = 0;
 	if (shared_repository < 0)
 		shared = -shared_repository;
 	else
@@ -344,9 +351,9 @@ int adjust_shared_perm(const char *path)
 	}
 
 	if (((shared_repository < 0
-	      ? (st.st_mode & (FORCE_DIR_SET_GID | 0777))
-	      : (st.st_mode & mode)) != mode) &&
-	    chmod(path, mode) < 0)
+	      ? (orig_mode & (FORCE_DIR_SET_GID | 0777))
+	      : (orig_mode & mode)) != mode) &&
+	    chmod(path, (mode & ~S_IFMT)) < 0)
 		return -2;
 	return 0;
 }
diff --git a/sha1_file.c b/sha1_file.c
index 8869488..5bfc36c 100644
--- a/sha1_file.c
+++ b/sha1_file.c
@@ -2263,7 +2263,7 @@ int move_temp_to_file(const char *tmpfile, const char *filename)
 	 *
 	 * The same holds for FAT formatted media.
 	 *
-	 * When this succeeds, we just return 0. We have nothing
+	 * When this succeeds, we just return; we have nothing
 	 * left to unlink.
 	 */
 	if (ret && ret != EEXIST) {
@@ -2280,7 +2280,7 @@ int move_temp_to_file(const char *tmpfile, const char *filename)
 	}
 
 out:
-	if (chmod(filename, 0444) || adjust_shared_perm(filename))
+	if (set_shared_perm(filename, (S_IFREG|0444)))
 		return error("unable to set permission to '%s'", filename);
 	return 0;
 }

^ permalink raw reply related

* Re: [PATCH 1/2] Move chmod(foo, 0444) into move_temp_to_file()
From: Junio C Hamano @ 2009-03-28  6:14 UTC (permalink / raw)
  To: Johan Herland; +Cc: Johannes Sixt, git
In-Reply-To: <200903261616.47185.johan@herland.net>

Johan Herland <johan@herland.net> writes:

> When writing out a loose object or a pack (index), move_temp_to_file() is
> called to finalize the resulting file. These files (loose files and packs)
> should all have permission mode 0444 (modulo adjust_shared_perm()).
> Therefore, instead of doing chmod(foo, 0444) explicitly from each callsite
> (or even forgetting to chmod() at all), do the chmod() call from within
> move_temp_to_file().
>
> Signed-off-by: Johan Herland <johan@herland.net>
> ---

I think you would need this on top.

-- >8 --
move_temp_to_file(): do not forget to chmod() in "Coda hack" codepath

Now move_temp_to_file() is responsible for doing everything that is
necessary to turn a tempfile in $GIT_DIR into its final form, it must make
sure "Coda hack" codepath correctly makes the file read-only.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
 sha1_file.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/sha1_file.c b/sha1_file.c
index 3bd20e7..8869488 100644
--- a/sha1_file.c
+++ b/sha1_file.c
@@ -2268,7 +2268,7 @@ int move_temp_to_file(const char *tmpfile, const char *filename)
 	 */
 	if (ret && ret != EEXIST) {
 		if (!rename(tmpfile, filename))
-			return 0;
+			goto out;
 		ret = errno;
 	}
 	unlink(tmpfile);
@@ -2279,6 +2279,7 @@ int move_temp_to_file(const char *tmpfile, const char *filename)
 		/* FIXME!!! Collision check here ? */
 	}
 
+out:
 	if (chmod(filename, 0444) || adjust_shared_perm(filename))
 		return error("unable to set permission to '%s'", filename);
 	return 0;

^ permalink raw reply related

* How do I force git to forget about merging a binary file that is to  stay deleted on the target branch?
From: Brent Goodrick @ 2009-03-28  5:26 UTC (permalink / raw)
  To: git

Hi,

How do I commit a merge but force git to forget about merging one file
that I don't want on the target branch, when it is binary, and when it
was changed on the source branch, but was deleted on the target branch
(and should stay deleted on the target branch)?

The details: I am merging a "work" branch into a "home" branch.  There
is one file called "TimeSheets/Timesheet Exempt.XLS" that is binary.
I don't want that file on the "home" branch, but do want it on the
"work" branch.  I had made an editing change to that file on the
"work" branch, along with a bunch of other changes I do want to merge
into the "home" branch. But no matter what I do, I can't force git to
forget about that "TimeSheets/Timesheet Exempt.XLS" file.

I've tried various flavors of git-checkout and git-reset to no
avail. This is what I see at the very last before I gave up:

Here is what I'm left with:

,----
| $ : gitw status
| TimeSheets/Timesheet Exempt.XLS: needs merge
| # On branch home
| # Changes to be committed:
| #   (use "git reset HEAD <file>..." to unstage)
| #
| <snipped out other files I do want to commit>
| #
| # Changed but not updated:
| #   (use "git add <file>..." to update what will be committed)
| #   (use "git checkout -- <file>..." to discard changes in working directory)
| #
| #	unmerged:   TimeSheets/Timesheet Exempt.XLS
| #
| $ : gitw commit -m "merge from work"
| TimeSheets/Timesheet Exempt.XLS: needs merge
| TimeSheets/Timesheet Exempt.XLS: unmerged
(49a49bd9de154daa8ca6cff3cfb550d0dd1b4519)
| TimeSheets/Timesheet Exempt.XLS: unmerged
(8de60b8b6827ef1f80921f6d35b574a56683bfdd)
| error: Error building trees
`----

Any help anyone can provide is greatly appreciated.

Thanks,
Brent

^ permalink raw reply

* [JGIT PATCH 2/2] Add cherry picking and revert support to JGit
From: Shawn O. Pearce @ 2009-03-28  2:53 UTC (permalink / raw)
  To: Robin Rosenberg; +Cc: git
In-Reply-To: <1238208832-29427-1-git-send-email-spearce@spearce.org>

A cherry-pick can be performed by a 3 way merge, where the base is
the parent of the commit you are cherry-picking, instead of using
the derived base from the commit graph.

By allowing the caller of a ThreeWayMerger to set the merge base
prior to invoking the merge method, we allow the caller to direct
us to execute a cherry-pick, or a revert.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
---
 .../tst/org/spearce/jgit/merge/CherryPickTest.java |  149 ++++++++++++++++++++
 .../src/org/spearce/jgit/merge/Merger.java         |   18 +++-
 .../jgit/merge/StrategySimpleTwoWayInCore.java     |    2 +-
 .../src/org/spearce/jgit/merge/ThreeWayMerger.java |   41 ++++++
 .../spearce/jgit/treewalk/CanonicalTreeParser.java |    2 +-
 5 files changed, 209 insertions(+), 3 deletions(-)
 create mode 100644 org.spearce.jgit.test/tst/org/spearce/jgit/merge/CherryPickTest.java

diff --git a/org.spearce.jgit.test/tst/org/spearce/jgit/merge/CherryPickTest.java b/org.spearce.jgit.test/tst/org/spearce/jgit/merge/CherryPickTest.java
new file mode 100644
index 0000000..78a5553
--- /dev/null
+++ b/org.spearce.jgit.test/tst/org/spearce/jgit/merge/CherryPickTest.java
@@ -0,0 +1,149 @@
+/*
+ * Copyright (C) 2009, Google Inc.
+ * Copyright (C) 2008, Robin Rosenberg
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or
+ * without modification, are permitted provided that the following
+ * conditions are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ *
+ * - Redistributions in binary form must reproduce the above
+ *   copyright notice, this list of conditions and the following
+ *   disclaimer in the documentation and/or other materials provided
+ *   with the distribution.
+ *
+ * - Neither the name of the Git Development Community nor the
+ *   names of its contributors may be used to endorse or promote
+ *   products derived from this software without specific prior
+ *   written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+ * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.spearce.jgit.merge;
+
+import java.io.ByteArrayInputStream;
+
+import org.spearce.jgit.dircache.DirCache;
+import org.spearce.jgit.dircache.DirCacheBuilder;
+import org.spearce.jgit.dircache.DirCacheEntry;
+import org.spearce.jgit.lib.Commit;
+import org.spearce.jgit.lib.Constants;
+import org.spearce.jgit.lib.FileMode;
+import org.spearce.jgit.lib.ObjectId;
+import org.spearce.jgit.lib.ObjectWriter;
+import org.spearce.jgit.lib.PersonIdent;
+import org.spearce.jgit.lib.RepositoryTestCase;
+import org.spearce.jgit.treewalk.TreeWalk;
+
+public class CherryPickTest extends RepositoryTestCase {
+	public void testPick() throws Exception {
+		// B---O
+		// \----P---T
+		//
+		// Cherry-pick "T" onto "O". This shouldn't introduce "p-fail", which
+		// was created by "P", nor should it modify "a", which was done by "P".
+		//
+		final DirCache treeB = DirCache.read(db);
+		final DirCache treeO = DirCache.read(db);
+		final DirCache treeP = DirCache.read(db);
+		final DirCache treeT = DirCache.read(db);
+		{
+			final DirCacheBuilder b = treeB.builder();
+			final DirCacheBuilder o = treeO.builder();
+			final DirCacheBuilder p = treeP.builder();
+			final DirCacheBuilder t = treeT.builder();
+
+			b.add(makeEntry("a", FileMode.REGULAR_FILE));
+
+			o.add(makeEntry("a", FileMode.REGULAR_FILE));
+			o.add(makeEntry("o", FileMode.REGULAR_FILE));
+
+			p.add(makeEntry("a", FileMode.REGULAR_FILE, "q"));
+			p.add(makeEntry("p-fail", FileMode.REGULAR_FILE));
+
+			t.add(makeEntry("a", FileMode.REGULAR_FILE));
+			t.add(makeEntry("t", FileMode.REGULAR_FILE));
+
+			b.finish();
+			o.finish();
+			p.finish();
+			t.finish();
+		}
+
+		final ObjectWriter ow = new ObjectWriter(db);
+		final ObjectId B = commit(ow, treeB, new ObjectId[] {});
+		final ObjectId O = commit(ow, treeO, new ObjectId[] { B });
+		final ObjectId P = commit(ow, treeP, new ObjectId[] { B });
+		final ObjectId T = commit(ow, treeT, new ObjectId[] { P });
+
+		ThreeWayMerger twm = MergeStrategy.SIMPLE_TWO_WAY_IN_CORE.newMerger(db);
+		twm.setBase(P);
+		boolean merge = twm.merge(new ObjectId[] { O, T });
+		assertTrue(merge);
+
+		final TreeWalk tw = new TreeWalk(db);
+		tw.setRecursive(true);
+		tw.reset(twm.getResultTreeId());
+
+		assertTrue(tw.next());
+		assertEquals("a", tw.getPathString());
+		assertCorrectId(treeO, tw);
+
+		assertTrue(tw.next());
+		assertEquals("o", tw.getPathString());
+		assertCorrectId(treeO, tw);
+
+		assertTrue(tw.next());
+		assertEquals("t", tw.getPathString());
+		assertCorrectId(treeT, tw);
+
+		assertFalse(tw.next());
+	}
+
+	private void assertCorrectId(final DirCache treeT, final TreeWalk tw) {
+		assertEquals(treeT.getEntry(tw.getPathString()).getObjectId(), tw
+				.getObjectId(0));
+	}
+
+	private ObjectId commit(final ObjectWriter ow, final DirCache treeB,
+			final ObjectId[] parentIds) throws Exception {
+		final Commit c = new Commit(db);
+		c.setTreeId(treeB.writeTree(ow));
+		c.setAuthor(new PersonIdent("A U Thor", "a.u.thor", 1L, 0));
+		c.setCommitter(c.getAuthor());
+		c.setParentIds(parentIds);
+		c.setMessage("Tree " + c.getTreeId().name());
+		return ow.writeCommit(c);
+	}
+
+	private DirCacheEntry makeEntry(final String path, final FileMode mode)
+			throws Exception {
+		return makeEntry(path, mode, path);
+	}
+
+	private DirCacheEntry makeEntry(final String path, final FileMode mode,
+			final String content) throws Exception {
+		final DirCacheEntry ent = new DirCacheEntry(path);
+		ent.setFileMode(mode);
+		final byte[] contentBytes = Constants.encode(content);
+		ent.setObjectId(new ObjectWriter(db).computeBlobSha1(
+				contentBytes.length, new ByteArrayInputStream(contentBytes)));
+		return ent;
+	}
+}
diff --git a/org.spearce.jgit/src/org/spearce/jgit/merge/Merger.java b/org.spearce.jgit/src/org/spearce/jgit/merge/Merger.java
index db3e329..2d5d44f 100644
--- a/org.spearce.jgit/src/org/spearce/jgit/merge/Merger.java
+++ b/org.spearce.jgit/src/org/spearce/jgit/merge/Merger.java
@@ -179,9 +179,25 @@ protected AbstractTreeIterator mergeBase(final int aIdx, final int bIdx)
 					+ sourceCommits[bIdx].name() + "found:" + "\n  "
 					+ base.name() + "\n  " + base2.name());
 		}
+		return openTree(base.getTree());
+	}
+
+	/**
+	 * Open an iterator over a tree.
+	 * 
+	 * @param treeId
+	 *            the tree to scan; must be a tree (not a treeish).
+	 * @return an iterator for the tree.
+	 * @throws IncorrectObjectTypeException
+	 *             the input object is not a tree.
+	 * @throws IOException
+	 *             the tree object is not found or cannot be read.
+	 */
+	protected AbstractTreeIterator openTree(final AnyObjectId treeId)
+			throws IncorrectObjectTypeException, IOException {
 		final WindowCursor curs = new WindowCursor();
 		try {
-			return new CanonicalTreeParser(null, db, base.getTree(), curs);
+			return new CanonicalTreeParser(null, db, treeId, curs);
 		} finally {
 			curs.release();
 		}
diff --git a/org.spearce.jgit/src/org/spearce/jgit/merge/StrategySimpleTwoWayInCore.java b/org.spearce.jgit/src/org/spearce/jgit/merge/StrategySimpleTwoWayInCore.java
index 9807644..5d4447c 100644
--- a/org.spearce.jgit/src/org/spearce/jgit/merge/StrategySimpleTwoWayInCore.java
+++ b/org.spearce.jgit/src/org/spearce/jgit/merge/StrategySimpleTwoWayInCore.java
@@ -102,7 +102,7 @@ InCoreMerger(final Repository local) {
 		@Override
 		protected boolean mergeImpl() throws IOException {
 			tw.reset();
-			tw.addTree(mergeBase(0, 1));
+			tw.addTree(mergeBase());
 			tw.addTree(sourceTrees[0]);
 			tw.addTree(sourceTrees[1]);
 
diff --git a/org.spearce.jgit/src/org/spearce/jgit/merge/ThreeWayMerger.java b/org.spearce.jgit/src/org/spearce/jgit/merge/ThreeWayMerger.java
index 9d1621d..6f041c1 100644
--- a/org.spearce.jgit/src/org/spearce/jgit/merge/ThreeWayMerger.java
+++ b/org.spearce.jgit/src/org/spearce/jgit/merge/ThreeWayMerger.java
@@ -40,11 +40,16 @@
 import java.io.IOException;
 
 import org.spearce.jgit.errors.IncorrectObjectTypeException;
+import org.spearce.jgit.errors.MissingObjectException;
 import org.spearce.jgit.lib.AnyObjectId;
 import org.spearce.jgit.lib.Repository;
+import org.spearce.jgit.revwalk.RevTree;
+import org.spearce.jgit.treewalk.AbstractTreeIterator;
 
 /** A merge of 2 trees, using a common base ancestor tree. */
 public abstract class ThreeWayMerger extends Merger {
+	private RevTree baseTree;
+
 	/**
 	 * Create a new merge instance for a repository.
 	 * 
@@ -56,6 +61,29 @@ protected ThreeWayMerger(final Repository local) {
 	}
 
 	/**
+	 * Set the common ancestor tree.
+	 * 
+	 * @param id
+	 *            common base treeish; null to automatically compute the common
+	 *            base from the input commits during
+	 *            {@link #merge(AnyObjectId, AnyObjectId)}.
+	 * @throws IncorrectObjectTypeException
+	 *             the object is not a treeish.
+	 * @throws MissingObjectException
+	 *             the object does not exist.
+	 * @throws IOException
+	 *             the object could not be read.
+	 */
+	public void setBase(final AnyObjectId id) throws MissingObjectException,
+			IncorrectObjectTypeException, IOException {
+		if (id != null) {
+			baseTree = walk.parseTree(id);
+		} else {
+			baseTree = null;
+		}
+	}
+
+	/**
 	 * Merge together two tree-ish objects.
 	 * <p>
 	 * Any tree-ish may be supplied as inputs. Commits and/or tags pointing at
@@ -86,4 +114,17 @@ public boolean merge(final AnyObjectId[] tips) throws IOException {
 			return false;
 		return super.merge(tips);
 	}
+
+	/**
+	 * Create an iterator to walk the merge base.
+	 * 
+	 * @return an iterator over the caller-specified merge base, or the natural
+	 *         merge base of the two input commits.
+	 * @throws IOException
+	 */
+	protected AbstractTreeIterator mergeBase() throws IOException {
+		if (baseTree != null)
+			return openTree(baseTree);
+		return mergeBase(0, 1);
+	}
 }
diff --git a/org.spearce.jgit/src/org/spearce/jgit/treewalk/CanonicalTreeParser.java b/org.spearce.jgit/src/org/spearce/jgit/treewalk/CanonicalTreeParser.java
index 7f89cff..ec1cf10 100644
--- a/org.spearce.jgit/src/org/spearce/jgit/treewalk/CanonicalTreeParser.java
+++ b/org.spearce.jgit/src/org/spearce/jgit/treewalk/CanonicalTreeParser.java
@@ -91,7 +91,7 @@ public CanonicalTreeParser() {
 	 *             a loose object or pack file could not be read.
 	 */
 	public CanonicalTreeParser(final byte[] prefix, final Repository repo,
-			final ObjectId treeId, final WindowCursor curs)
+			final AnyObjectId treeId, final WindowCursor curs)
 			throws IncorrectObjectTypeException, IOException {
 		super(prefix);
 		reset(repo, treeId, curs);
-- 
1.6.2.1.471.g682837

^ permalink raw reply related

* [JGIT PATCH 1/2] Introduce ThreeWayMerge API
From: Shawn O. Pearce @ 2009-03-28  2:53 UTC (permalink / raw)
  To: Robin Rosenberg; +Cc: git

A 3-way merge (2 trees, and one common ancestor) is a specialized
type of merge which has a tighter restriction on its inputs.  This
change refactors the merge API slightly to introduce this special
type, so we can add 3-way specific operations on the API.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
---

 This is a quick two patch series to teach JGit enough to enable an
 application to perform simple cherry-picks, much like we already
 support doing simple merges.

 I'm already using it in Gerrit Code Review to enable projects to
 have a more "format-patch | am" style workflow over a "push; pull"
 style of workflow, if they choose to do that.


 .../src/org/spearce/jgit/merge/MergeStrategy.java  |    2 +-
 .../src/org/spearce/jgit/merge/Merger.java         |    2 +-
 .../jgit/merge/StrategySimpleTwoWayInCore.java     |   11 +--
 .../spearce/jgit/merge/ThreeWayMergeStrategy.java  |   46 ++++++++++
 .../src/org/spearce/jgit/merge/ThreeWayMerger.java |   89 ++++++++++++++++++++
 5 files changed, 141 insertions(+), 9 deletions(-)
 create mode 100644 org.spearce.jgit/src/org/spearce/jgit/merge/ThreeWayMergeStrategy.java
 create mode 100644 org.spearce.jgit/src/org/spearce/jgit/merge/ThreeWayMerger.java

diff --git a/org.spearce.jgit/src/org/spearce/jgit/merge/MergeStrategy.java b/org.spearce.jgit/src/org/spearce/jgit/merge/MergeStrategy.java
index 66bd86c..5439e5c 100644
--- a/org.spearce.jgit/src/org/spearce/jgit/merge/MergeStrategy.java
+++ b/org.spearce.jgit/src/org/spearce/jgit/merge/MergeStrategy.java
@@ -55,7 +55,7 @@
 	public static final MergeStrategy THEIRS = new StrategyOneSided("theirs", 1);
 
 	/** Simple strategy to merge paths, without simultaneous edits. */
-	public static final MergeStrategy SIMPLE_TWO_WAY_IN_CORE = StrategySimpleTwoWayInCore.INSTANCE;
+	public static final ThreeWayMergeStrategy SIMPLE_TWO_WAY_IN_CORE = StrategySimpleTwoWayInCore.INSTANCE;
 
 	private static final HashMap<String, MergeStrategy> STRATEGIES = new HashMap<String, MergeStrategy>();
 
diff --git a/org.spearce.jgit/src/org/spearce/jgit/merge/Merger.java b/org.spearce.jgit/src/org/spearce/jgit/merge/Merger.java
index 100cc38..db3e329 100644
--- a/org.spearce.jgit/src/org/spearce/jgit/merge/Merger.java
+++ b/org.spearce.jgit/src/org/spearce/jgit/merge/Merger.java
@@ -122,7 +122,7 @@ public ObjectWriter getObjectWriter() {
 	 *             one or more sources could not be read, or outputs could not
 	 *             be written to the Repository.
 	 */
-	public final boolean merge(final AnyObjectId[] tips) throws IOException {
+	public boolean merge(final AnyObjectId[] tips) throws IOException {
 		sourceObjects = new RevObject[tips.length];
 		for (int i = 0; i < tips.length; i++)
 			sourceObjects[i] = walk.parseAny(tips[i]);
diff --git a/org.spearce.jgit/src/org/spearce/jgit/merge/StrategySimpleTwoWayInCore.java b/org.spearce.jgit/src/org/spearce/jgit/merge/StrategySimpleTwoWayInCore.java
index 3ebe397..9807644 100644
--- a/org.spearce.jgit/src/org/spearce/jgit/merge/StrategySimpleTwoWayInCore.java
+++ b/org.spearce.jgit/src/org/spearce/jgit/merge/StrategySimpleTwoWayInCore.java
@@ -60,8 +60,8 @@
  * trees will cause a merge conflict, as this strategy does not attempt to merge
  * file contents.
  */
-public class StrategySimpleTwoWayInCore extends MergeStrategy {
-	static final MergeStrategy INSTANCE = new StrategySimpleTwoWayInCore();
+public class StrategySimpleTwoWayInCore extends ThreeWayMergeStrategy {
+	static final ThreeWayMergeStrategy INSTANCE = new StrategySimpleTwoWayInCore();
 
 	/** Create a new instance of the strategy. */
 	protected StrategySimpleTwoWayInCore() {
@@ -74,11 +74,11 @@ public String getName() {
 	}
 
 	@Override
-	public Merger newMerger(final Repository db) {
+	public ThreeWayMerger newMerger(final Repository db) {
 		return new InCoreMerger(db);
 	}
 
-	private static class InCoreMerger extends Merger {
+	private static class InCoreMerger extends ThreeWayMerger {
 		private static final int T_BASE = 0;
 
 		private static final int T_OURS = 1;
@@ -101,9 +101,6 @@ InCoreMerger(final Repository local) {
 
 		@Override
 		protected boolean mergeImpl() throws IOException {
-			if (sourceTrees.length != 2)
-				return false;
-
 			tw.reset();
 			tw.addTree(mergeBase(0, 1));
 			tw.addTree(sourceTrees[0]);
diff --git a/org.spearce.jgit/src/org/spearce/jgit/merge/ThreeWayMergeStrategy.java b/org.spearce.jgit/src/org/spearce/jgit/merge/ThreeWayMergeStrategy.java
new file mode 100644
index 0000000..848e80b
--- /dev/null
+++ b/org.spearce.jgit/src/org/spearce/jgit/merge/ThreeWayMergeStrategy.java
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2009, Google Inc.
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or
+ * without modification, are permitted provided that the following
+ * conditions are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ *
+ * - Redistributions in binary form must reproduce the above
+ *   copyright notice, this list of conditions and the following
+ *   disclaimer in the documentation and/or other materials provided
+ *   with the distribution.
+ *
+ * - Neither the name of the Git Development Community nor the
+ *   names of its contributors may be used to endorse or promote
+ *   products derived from this software without specific prior
+ *   written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+ * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+package org.spearce.jgit.merge;
+
+import org.spearce.jgit.lib.Repository;
+
+/** A merge strategy to merge 2 trees, using a common base ancestor tree. */
+public abstract class ThreeWayMergeStrategy extends MergeStrategy {
+	@Override
+	public abstract ThreeWayMerger newMerger(Repository db);
+}
diff --git a/org.spearce.jgit/src/org/spearce/jgit/merge/ThreeWayMerger.java b/org.spearce.jgit/src/org/spearce/jgit/merge/ThreeWayMerger.java
new file mode 100644
index 0000000..9d1621d
--- /dev/null
+++ b/org.spearce.jgit/src/org/spearce/jgit/merge/ThreeWayMerger.java
@@ -0,0 +1,89 @@
+/*
+ * Copyright (C) 2009, Google Inc.
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or
+ * without modification, are permitted provided that the following
+ * conditions are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ *   notice, this list of conditions and the following disclaimer.
+ *
+ * - Redistributions in binary form must reproduce the above
+ *   copyright notice, this list of conditions and the following
+ *   disclaimer in the documentation and/or other materials provided
+ *   with the distribution.
+ *
+ * - Neither the name of the Git Development Community nor the
+ *   names of its contributors may be used to endorse or promote
+ *   products derived from this software without specific prior
+ *   written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+ * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+package org.spearce.jgit.merge;
+
+import java.io.IOException;
+
+import org.spearce.jgit.errors.IncorrectObjectTypeException;
+import org.spearce.jgit.lib.AnyObjectId;
+import org.spearce.jgit.lib.Repository;
+
+/** A merge of 2 trees, using a common base ancestor tree. */
+public abstract class ThreeWayMerger extends Merger {
+	/**
+	 * Create a new merge instance for a repository.
+	 * 
+	 * @param local
+	 *            the repository this merger will read and write data on.
+	 */
+	protected ThreeWayMerger(final Repository local) {
+		super(local);
+	}
+
+	/**
+	 * Merge together two tree-ish objects.
+	 * <p>
+	 * Any tree-ish may be supplied as inputs. Commits and/or tags pointing at
+	 * trees or commits may be passed as input objects.
+	 * 
+	 * @param a
+	 *            source tree to be combined together.
+	 * @param b
+	 *            source tree to be combined together.
+	 * @return true if the merge was completed without conflicts; false if the
+	 *         merge strategy cannot handle this merge or there were conflicts
+	 *         preventing it from automatically resolving all paths.
+	 * @throws IncorrectObjectTypeException
+	 *             one of the input objects is not a commit, but the strategy
+	 *             requires it to be a commit.
+	 * @throws IOException
+	 *             one or more sources could not be read, or outputs could not
+	 *             be written to the Repository.
+	 */
+	public boolean merge(final AnyObjectId a, final AnyObjectId b)
+			throws IOException {
+		return merge(new AnyObjectId[] { a, b });
+	}
+
+	@Override
+	public boolean merge(final AnyObjectId[] tips) throws IOException {
+		if (tips.length != 2)
+			return false;
+		return super.merge(tips);
+	}
+}
-- 
1.6.2.1.471.g682837

^ permalink raw reply related

* [PATCH] test-lib: Clean up comments and Makefile.
From: Emil Sit @ 2009-03-28  1:57 UTC (permalink / raw)
  To: git

Bring documentation in test-lib and clean target
in Makefile in-line with abc5d372.

Signed-off-by: Emil Sit <sit@emilsit.net>
---
 t/Makefile    |    2 +-
 t/test-lib.sh |    8 --------
 2 files changed, 1 insertions(+), 9 deletions(-)

diff --git a/t/Makefile b/t/Makefile
index 0962341..bf816fc 100644
--- a/t/Makefile
+++ b/t/Makefile
@@ -24,7 +24,7 @@ pre-clean:
 	$(RM) -r test-results
 
 clean:
-	$(RM) -r 'trash directory' test-results
+	$(RM) -r 'trash directory'.* test-results
 
 aggregate-results-and-cleanup: $(T)
 	$(MAKE) aggregate-results
diff --git a/t/test-lib.sh b/t/test-lib.sh
index 2979e8e..b050196 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -523,14 +523,6 @@ test_done () {
 	fi
 	case "$test_failure" in
 	0)
-		# We could:
-		# cd .. && rm -fr 'trash directory'
-		# but that means we forbid any tests that use their own
-		# subdirectory from calling test_done without coming back
-		# to where they started from.
-		# The Makefile provided will clean this test area so
-		# we will leave things as they are.
-
 		say_color pass "passed all $msg"
 
 		test -d "$remove_trash" &&
-- 
1.5.4.3

-- 
Emil Sit / http://www.emilsit.net/

^ permalink raw reply related

* Re: On git 1.6 (novice's opinion)
From: Junio C Hamano @ 2009-03-28  1:30 UTC (permalink / raw)
  To: Ulrich Windl; +Cc: Dmitry Potapov, H.Merijn Brand, git
In-Reply-To: <49CCE520.17260.2586E134@Ulrich.Windl.rkdvmks1.ngate.uni-regensburg.de>

"Ulrich Windl" <ulrich.windl@rz.uni-regensburg.de> writes:

> AFAIK, "committing" in git is "kind of publishing your work" (others may
> pull it).

You, like all the other people who worked with centralized systems for too
long, need a break from this misconception.  Once you get rid of it, you
will realize that the separation of commit (which is merely "recording so
that you can later refer to it, including for the purposes of going back
to it, comparing something else with it and merge something else with it")
and push (which is the "publishing" part) is the fundamental difference
between centralized and distributed systems.  It frees you from having to
worry about the "damned if you commit, damned if you don't" issue I
mentioned in my other message.

^ permalink raw reply

* Re: On git 1.6 (novice's opinion)
From: Junio C Hamano @ 2009-03-28  1:30 UTC (permalink / raw)
  To: Dmitry Potapov; +Cc: Ulrich Windl, H.Merijn Brand, git
In-Reply-To: <37fcd2780903270524y39456c5fre0a2f8f9c5f4d160@mail.gmail.com>

Dmitry Potapov <dpotapov@gmail.com> writes:

> On Fri, Mar 27, 2009 at 12:50 PM, Ulrich Windl
> <ulrich.windl@rz.uni-regensburg.de> wrote:
>>
>> what made me wonder is this (about item 1): I thought I've read that blobs store
>> content and attributes, so very obviously I wondered why not store thr "right
>> attributes" (i.e. the time of the file). My reasoning: You make some changes, then
>> test them (which might last several hours or days). The if I'm happy I'll
>> "commit".
>
> With Git, you usually commit your changes immediately (without waiting
> the result
> of testing), because you can always undo commit until you publish your changes.

Heh, "can" and "usually" are somewhat different.  I don't.

^ permalink raw reply

* Re: On git 1.6 (novice's opinion)
From: Junio C Hamano @ 2009-03-28  1:30 UTC (permalink / raw)
  To: Ulrich Windl; +Cc: git
In-Reply-To: <49CC8C90.12268.242CEFCE@Ulrich.Windl.rkdvmks1.ngate.uni-regensburg.de>

"Ulrich Windl" <ulrich.windl@rz.uni-regensburg.de> writes:

> ... Also some seemingly dangerous commands that cannot easily be undone
> should ask safety questions ("cvs merge (-j)" would also fall into that
> category.

This is slightly an interesting point.

In CVS and Subversion, "merge" (rather "update") can be a dangerous
operation.  You start working, you keep building, and you eventually
accumulate quite a lot of changes but you still cannot see the end of the
tunnel.  Your changes are incomplete and you will upset others if you
commit.  Your changes are extensive enough that it can conflict heavily
with what others have done already, and there is a high chance that you
can screw up the merging but there is no easy way (unless you tar-up the
whole work tree before attempting to update) to get back to the state
before your merge.  Damned if you commit, damned if you don't.  You lose
either way.

This is because you cannot have a local commit.  The problem is inherent
to the centralized nature of these systems.

Distributed systems are different.  Unlike CVS/Subversion's

	work work work; then

        update to merge, risk screwing up the work in progress (or almost
	finished work); then

        commit

workflow, in a distributed system, you first commit and then merge,
preferably from a clean slate.  You will not have to worry about screwing
up the conflict resolution, because both states (what the other guy did,
and what you did) are committed safely away and you can reset back to the
state before you start your merge.

^ permalink raw reply

* Newbie installation problem: non 7-zip archive
From: Angus Monro @ 2009-03-28  1:13 UTC (permalink / raw)
  To: git

Hi,

I’m just looking at GIT for the first time, but can’t get past first base.

I’m working on Win XP 2002 SP3.  

When I download & run PortableGit-1.6.2.1-preview20090322.exe, it asks for
the installation location, but after I’ve confirmed that location & pressed
OK, it gives me an error message window:
     Title bar:   “WinGit: MinGW Git + minimal MSys installation: error”
     Message:     “Non 7-Zip archive.”

When I download & run Git-1.6.2.1-preview20090322.exe, it immediately
complains
     Title bar:   “Error”
     Message:     “The setup files are corrupted.  Please obtain a new copy
of the program.”

In both cases, I’ve downloaded from
http://code.google.com/p/msysgit/downloads/list, and have tried
re-downloading & re-running, still without success.

Any thoughts?

Thanks,

Angus Monro.

^ permalink raw reply

* Re: patch series starting with [JGIT PATCH 1/5] Remove dead/unused reset method from CountingOutputStream
From: Robin Rosenberg @ 2009-03-27 23:53 UTC (permalink / raw)
  To: Shawn O. Pearce; +Cc: Marek Zawirski, Daniel Cheng, git
In-Reply-To: <20090327145550.GN23521@spearce.org>

fredag 27 mars 2009 15:55:50 skrev "Shawn O. Pearce" <spearce@spearce.org>:
> Robin Rosenberg <robin.rosenberg.lists@dewire.com> wrote:
> > Seems fine. While verifying this I got this error.
> > 
> > jgit push sftp://me@calhost/home/me/tmp/cb/.git master:master
> > 
> > Counting objects:       20464
> > Compressing objects:    100% (20464/20464)
> > Writing objects:        100% (20464/20464)
> > fatal: Can't write /home/me/tmp/cb/.git/objects/../HEAD: Failure
> > fatal: sftp://me@localhost/home/me/tmp/cb/.git: cannot create HEAD
> 
> I can't reproduce this error with sftp://.
> 
> At first, it failed to push because my target directory didn't exist.
Same here.

> After I made the target directory, I also had to create below it
> "refs", "objects", "objects/pack" in order to get the push to
> succeed, and then it went through clean.

hm, I git init'd the repo on the server, that's cheating I suppose.

-- robin

^ permalink raw reply

* Re: Git Download/Bootstrap Suggestion
From: Sverre Rabbelier @ 2009-03-27 23:21 UTC (permalink / raw)
  To: Mike Gaffney; +Cc: git
In-Reply-To: <49CD0841.9000602@gmail.com>

Heya,

On Fri, Mar 27, 2009 at 18:09, Mike Gaffney <mr.gaffo@gmail.com> wrote:
> I have to do is
> - download the source tarball (or the rpm)
> - make it
> - install it

Nah, you don't need to do all that ;).


> It'd be a lot cooler if I could just wget a full get repo on the latest tag

You mean like, this?

http://repo.or.cz/w/git.git?a=snapshot;h=master;sf=tgz

-- 
Cheers,

Sverre Rabbelier

^ permalink raw reply

* git svn clone failure
From: Lachlan Deck @ 2009-03-27 21:18 UTC (permalink / raw)
  To: git

Hi there,

I'm trying to clone an existing svn repository with git (just getting  
started with git) and it keeps failing with:
...
r604 = 6428e63734a21ee5fcb4593274747e2758578a91 (git-svn)
fatal: unable to run 'git-svn'

I'm using git version 1.6.2
Mac OS X 10.5.6. git installed via macports with svn support.

Any ideas? How do I find out why it's failing?
Thanks.

with regards,
--

Lachlan Deck

^ permalink raw reply

* (unknown), 
From: Lachlan Deck @ 2009-03-27 20:39 UTC (permalink / raw)
  To: git

subscribe

^ permalink raw reply

* Re: [PATCH 1/3] rebase: fix typo (force_rebas -> force-rebas)
From: Michele Ballabio @ 2009-03-27 18:58 UTC (permalink / raw)
  To: gitster; +Cc: git
In-Reply-To: <1237399558-27289-1-git-send-email-barra_cuda@katamail.com>

Just a reminder, since this patch was probably dropped.

On Wednesday 18 March 2009, Michele Ballabio wrote:
> Signed-off-by: Michele Ballabio <barra_cuda@katamail.com>
> ---
>  git-rebase.sh |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/git-rebase.sh b/git-rebase.sh
> index d38ab0b..e38d68a 100755
> --- a/git-rebase.sh
> +++ b/git-rebase.sh
> @@ -315,7 +315,7 @@ do
>  	--root)
>  		rebase_root=t
>  		;;
> -	-f|--f|--fo|--for|--forc|force|--force-r|--force-re|--force-reb|--force-reba|--force_rebas|--force-rebase)
> +	-f|--f|--fo|--for|--forc|force|--force-r|--force-re|--force-reb|--force-reba|--force-rebas|--force-rebase)
>  		force_rebase=t
>  		;;
>  	-*)

^ permalink raw reply

* Re: [PATCH] Two RPM building improvements
From: Michael J Gruber @ 2009-03-27 19:43 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Jakub Narebski, Niels Basjes, git
In-Reply-To: <7vvdpvdjj4.fsf@gitster.siamese.dyndns.org>

Junio C Hamano venit, vidit, dixit 27.03.2009 17:20:
> Jakub Narebski <jnareb@gmail.com> writes:
> 
>> Niels Basjes <Niels@Basjes.nl> writes:
>>
>>> Two RPM building improvements:
>>
>> Two _unrelated_ RPM building improvements squashed in one commit.
>>
>>>   - Building the RPMs can now be done by a non-root user.
>>
>> It was always possible, you only have to configure rpm / rpmbuild,
>> namely put path to where you want your RPM_BUILDING directory in
>> ~/.rpmmacros as %_topdir, for example:
>>
>>   $ cat ~/.rpmmacros
>>   %_topdir        /home/local/builddir
>>
>> Please RTFM first, before going to solve non-problem in (ugh) fairly
>> complicated way.
> 
> That might be a bit too harsh to somebody who genuinely wished to share
> his improvement with others.
> 
> Being RPM novice, the first thing I asked around immediately after taking
> the maintainership over was the ~/.rpmmacros trick.  We really should
> mention it in _our_ documentation, even just a sentence or two would be
> sufficient.

I assumed everyone building rpms would use rpmdev-setuptree from
rpmdevtools, but apparently not ;) I'm not sure whether non-Redhat
rpm-based distros have that, though.

I'm wondering a bit about the all-rpms target. How does this work
without mock? All build requirements installed for all platforms?? I
think it really calls for a mock build/vm (unless i386 on x86_64).

Michael

^ permalink raw reply


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox