Git development
 help / color / mirror / Atom feed
* Re: Overwrite master
From: Nicholas Wieland @ 2008-12-02 20:09 UTC (permalink / raw)
  To: Peter Harris; +Cc: git
In-Reply-To: <eaa105840812020832p395ecefdq57e62f95182a3557@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 775 bytes --]

Il giorno 02/dic/08, alle ore 17:32, Peter Harris ha scritto:

> On Tue, Dec 2, 2008 at 11:10 AM, Nicholas Wieland wrote:
>> Hi *,
>> I need to overwrite my master branch with another branch. I've  
>> already
>> created a backup branch of my master.
>
> While on master,
> "git reset --hard <newbranch>"
>
> Or while on a different branch,
> git branch -D master
> git branch master <newbranch>

That's what I tried.
Unfortunately I don't know where to go after:

ngw@slicingupeyeballs ~/zooppa$ git commit
# On branch master
# Your branch and 'origin/master' have diverged,
# and have 444 and 25 different commit(s) each, respectively.
#
nothing to commit (working directory clean)

Do I have to push ? If I pull it tries to merge ...


Thanks a lot for your time,
   ngw


[-- Attachment #2: smime.p7s --]
[-- Type: application/pkcs7-signature, Size: 2435 bytes --]

^ permalink raw reply

* Re: [PATCH] Modified the default git help message to be grouped by topic
From: James Pickens @ 2008-12-02 20:11 UTC (permalink / raw)
  To: Scott Chacon; +Cc: Junio C Hamano, Jeff King, git
In-Reply-To: <d411cc4a0812012210h4cb59974sbda71abd2c64f93b@mail.gmail.com>

On Mon, Dec 1, 2008 at 11:10 PM, Scott Chacon <schacon@gmail.com> wrote:
> Hi,
>
> On Mon, Dec 1, 2008 at 5:45 PM, Junio C Hamano <gitster@pobox.com> wrote:
>> If this list is meant to show "the most commonly used" basics, then you
>> can trim the list somewhat.  For example, "rm" and "mv" can be safely
>> discarded, "status" can be replaced with "diff", and "diff" can be removed
>> from "History Commands".
>>
>
> I sent a new patch that removes 'rm' and 'mv' and removes the
> common-cmd.h build process. I did keep the 'status' command, since in
> my personal experience people tend to like having that command.

Even though 'rm' might not be used very often, I think it's an important
enough command that it should not be removed from the 'basics' list.
AFAIK, the only other way to delete a file is 'rm file' followed by 'git
add -u' or 'git commit -a'.  Imagine a git newbie trying to figure that
out.

I'm tempted to say the same thing about 'mv' as well.  And FWIW, I use
'status' a lot more than I use 'diff', so I would vote to keep 'status' in
the list too.

James

^ permalink raw reply

* Multiple SVN Repos Inside A Git Repo
From: Tim Sally @ 2008-12-02 20:22 UTC (permalink / raw)
  To: git

Using git-svn, it is possible to have different parts of a git repo
correspond to a specific svn repo? From my understanding after reading
the documentation, you need one git repository per svn.  My example is
that I'm trying to set up a git repo to version control everything
from my classes, but each class has a separate svn repo.  Also, the
number of git repos I can create is limited, and I'd rather not
clutter everything up with many separate git-svn repos.

Example structure:

class/
.......... systems/
.......... algorithms/
.......... physics/

class is one central git repository, and systems, algorithms, and
physics contain data from three svn repositories.  Ideally, you could
commit/update to/from each svn repo individually, or all at once.

Tim

^ permalink raw reply

* Re: Overwrite master
From: Peter Harris @ 2008-12-02 20:28 UTC (permalink / raw)
  To: Nicholas Wieland; +Cc: git
In-Reply-To: <67A24C29-12A6-43B0-95D5-70910C5F8841@gmail.com>

On Tue, Dec 2, 2008 at 3:09 PM, Nicholas Wieland wrote:
> Il giorno 02/dic/08, alle ore 17:32, Peter Harris ha scritto:
>
>> On Tue, Dec 2, 2008 at 11:10 AM, Nicholas Wieland wrote:
>>>
>>> Hi *,
>>> I need to overwrite my master branch with another branch. I've already
>>> created a backup branch of my master.
>>
>> While on master,
>> "git reset --hard <newbranch>"
>
> That's what I tried.
> Unfortunately I don't know where to go after:
>
> ngw@slicingupeyeballs ~/zooppa$ git commit
> # On branch master
> # Your branch and 'origin/master' have diverged,
> # and have 444 and 25 different commit(s) each, respectively.
> #
> nothing to commit (working directory clean)

That means your tracking branch is different from your local branch, by a lot.

> Do I have to push ? If I pull it tries to merge ...

If you push, it will be denied (non-fast-forward).

If you force push, your state will be as you expect. Be aware that
you're creating trouble for everyone else who uses 'origin' if you
force push. Also be aware that you will be undoing any changes that
anyone else has pushed to origin in the mean time.

Basically, history is history. If you don't want to cause problems for
the other users of 'origin', you may have to live with history as it
is. You won't be able to overwrite master, although you will probably
try to be more careful in the future.

Peter Harris

^ permalink raw reply

* [PATCH] gitk: Use check-buttons' -text property instead of separate labels
From: Johannes Sixt @ 2008-12-02 20:42 UTC (permalink / raw)
  To: Paul Mackerras; +Cc: git

Previously the check-buttons' labels in the Preferences were separate
widgets. This had the disadvantage that in order to toggle the check-button
with the mouse the check-box had to be clicked. With this change the
check-box can also be toggled by clicking the label.

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
---
 gitk |   30 ++++++++++--------------------
 1 files changed, 10 insertions(+), 20 deletions(-)

diff --git a/gitk b/gitk
index 64a873d..ee1941c 100755
--- a/gitk
+++ b/gitk
@@ -10079,15 +10079,11 @@ proc doprefs {} {
 	-font optionfont
     spinbox $top.maxpct -from 1 -to 100 -width 4 -textvariable maxgraphpct
     grid x $top.maxpctl $top.maxpct -sticky w
-    frame $top.showlocal
-    label $top.showlocal.l -text [mc "Show local changes"] -font optionfont
-    checkbutton $top.showlocal.b -variable showlocalchanges
-    pack $top.showlocal.b $top.showlocal.l -side left
+    checkbutton $top.showlocal -text [mc "Show local changes"] \
+	-font optionfont -variable showlocalchanges
     grid x $top.showlocal -sticky w
-    frame $top.autoselect
-    label $top.autoselect.l -text [mc "Auto-select SHA1"] -font optionfont
-    checkbutton $top.autoselect.b -variable autoselect
-    pack $top.autoselect.b $top.autoselect.l -side left
+    checkbutton $top.autoselect -text [mc "Auto-select SHA1"] \
+	-font optionfont -variable autoselect
     grid x $top.autoselect -sticky w
 
     label $top.ddisp -text [mc "Diff display options"]
@@ -10095,20 +10091,14 @@ proc doprefs {} {
     label $top.tabstopl -text [mc "Tab spacing"] -font optionfont
     spinbox $top.tabstop -from 1 -to 20 -width 4 -textvariable tabstop
     grid x $top.tabstopl $top.tabstop -sticky w
-    frame $top.ntag
-    label $top.ntag.l -text [mc "Display nearby tags"] -font optionfont
-    checkbutton $top.ntag.b -variable showneartags
-    pack $top.ntag.b $top.ntag.l -side left
+    checkbutton $top.ntag -text [mc "Display nearby tags"] \
+	-font optionfont -variable showneartags
     grid x $top.ntag -sticky w
-    frame $top.ldiff
-    label $top.ldiff.l -text [mc "Limit diffs to listed paths"] -font optionfont
-    checkbutton $top.ldiff.b -variable limitdiffs
-    pack $top.ldiff.b $top.ldiff.l -side left
+    checkbutton $top.ldiff -text [mc "Limit diffs to listed paths"] \
+	-font optionfont -variable limitdiffs
     grid x $top.ldiff -sticky w
-    frame $top.lattr
-    label $top.lattr.l -text [mc "Support per-file encodings"] -font optionfont
-    checkbutton $top.lattr.b -variable perfile_attrs
-    pack $top.lattr.b $top.lattr.l -side left
+    checkbutton $top.lattr -text [mc "Support per-file encodings"] \
+	-font optionfont -variable perfile_attrs
     grid x $top.lattr -sticky w
 
     entry $top.extdifft -textvariable extdifftool
-- 
1.6.0.4.763.g42102

^ permalink raw reply related

* [JGIT PATCH 1/2] Close a forgotten reference to the HEAD ref.
From: Robin Rosenberg @ 2008-12-02 21:20 UTC (permalink / raw)
  To: spearce; +Cc: git, Robin Rosenberg

Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
---
 .../src/org/spearce/jgit/lib/Repository.java       |   12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/org.spearce.jgit/src/org/spearce/jgit/lib/Repository.java b/org.spearce.jgit/src/org/spearce/jgit/lib/Repository.java
index c953531..b54afd5 100644
--- a/org.spearce.jgit/src/org/spearce/jgit/lib/Repository.java
+++ b/org.spearce.jgit/src/org/spearce/jgit/lib/Repository.java
@@ -989,9 +989,10 @@ public Ref peel(final Ref ref) {
 	 * @return true if HEAD points to a StGit patch.
 	 */
 	public boolean isStGitMode() {
+		File file = new File(getDirectory(), "HEAD");
+		BufferedReader reader = null;
 		try {
-			File file = new File(getDirectory(), "HEAD");
-			BufferedReader reader = new BufferedReader(new FileReader(file));
+			reader = new BufferedReader(new FileReader(file));
 			String string = reader.readLine();
 			if (!string.startsWith("ref: refs/heads/"))
 				return false;
@@ -1007,6 +1008,13 @@ public boolean isStGitMode() {
 		} catch (IOException e) {
 			e.printStackTrace();
 			return false;
+		} finally {
+			try {
+				if (reader != null)
+					reader.close();
+			} catch (IOException e1) {
+				// nothing to do here
+			}
 		}
 	}
 
-- 
1.6.0.3.640.g6331a

^ permalink raw reply related

* [JGIT PATCH 2/2] Improve closing of files in error situations.
From: Robin Rosenberg @ 2008-12-02 21:20 UTC (permalink / raw)
  To: spearce; +Cc: git, Robin Rosenberg
In-Reply-To: <1228252816-5987-1-git-send-email-robin.rosenberg@dewire.com>

Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
---
 .../exttst/org/spearce/jgit/lib/SpeedTestBase.java |   12 +++++--
 .../src/org/spearce/jgit/lib/Repository.java       |   31 +++++++++++++-------
 2 files changed, 28 insertions(+), 15 deletions(-)

diff --git a/org.spearce.jgit.test/exttst/org/spearce/jgit/lib/SpeedTestBase.java b/org.spearce.jgit.test/exttst/org/spearce/jgit/lib/SpeedTestBase.java
index 11f7439..36a5e0e 100644
--- a/org.spearce.jgit.test/exttst/org/spearce/jgit/lib/SpeedTestBase.java
+++ b/org.spearce.jgit.test/exttst/org/spearce/jgit/lib/SpeedTestBase.java
@@ -72,10 +72,14 @@
 	protected void prepare(String[] refcmd) throws Exception {
 		try {
 			BufferedReader bufferedReader = new BufferedReader(new FileReader("kernel.ref"));
-			kernelrepo = bufferedReader.readLine();
-			bufferedReader.close();
-			timeNativeGit(kernelrepo, refcmd);
-			nativeTime = timeNativeGit(kernelrepo, refcmd);
+			try {
+				kernelrepo = bufferedReader.readLine();
+				bufferedReader.close();
+				timeNativeGit(kernelrepo, refcmd);
+				nativeTime = timeNativeGit(kernelrepo, refcmd);
+			} finally {
+				bufferedReader.close();
+			}
 		} catch (Exception e) {
 			System.out.println("Create a file named kernel.ref and put the path to the Linux kernels repository there");
 			throw e;
diff --git a/org.spearce.jgit/src/org/spearce/jgit/lib/Repository.java b/org.spearce.jgit/src/org/spearce/jgit/lib/Repository.java
index b54afd5..da1494f 100644
--- a/org.spearce.jgit/src/org/spearce/jgit/lib/Repository.java
+++ b/org.spearce.jgit/src/org/spearce/jgit/lib/Repository.java
@@ -144,10 +144,13 @@ public Repository(final File d) throws IOException {
 		final File altFile = FS.resolve(objectsDir, "info/alternates");
 		if (altFile.exists()) {
 			BufferedReader ar = new BufferedReader(new FileReader(altFile));
-			for (String alt=ar.readLine(); alt!=null; alt=ar.readLine()) {
-				readObjectsDirs(FS.resolve(objectsDir, alt), ret);
+			try {
+				for (String alt=ar.readLine(); alt!=null; alt=ar.readLine()) {
+					readObjectsDirs(FS.resolve(objectsDir, alt), ret);
+				}
+			} catch (Exception e) {
+				ar.close();
 			}
-			ar.close();
 		}
 		return ret;
 	}
@@ -1027,15 +1030,21 @@ public boolean isStGitMode() {
 		if (isStGitMode()) {
 			File patchDir = new File(new File(getDirectory(),"patches"),getBranch());
 			BufferedReader apr = new BufferedReader(new FileReader(new File(patchDir,"applied")));
-			for (String patchName=apr.readLine(); patchName!=null; patchName=apr.readLine()) {
-				File topFile = new File(new File(new File(patchDir,"patches"), patchName), "top");
-				BufferedReader tfr = new BufferedReader(new FileReader(topFile));
-				String objectId = tfr.readLine();
-				ObjectId id = ObjectId.fromString(objectId);
-				ret.put(id, new StGitPatch(patchName, id));
-				tfr.close();
+			try {
+				for (String patchName=apr.readLine(); patchName!=null; patchName=apr.readLine()) {
+					File topFile = new File(new File(new File(patchDir,"patches"), patchName), "top");
+					BufferedReader tfr = new BufferedReader(new FileReader(topFile));
+					try {
+						String objectId = tfr.readLine();
+						ObjectId id = ObjectId.fromString(objectId);
+						ret.put(id, new StGitPatch(patchName, id));
+					} finally {
+						tfr.close();
+					}
+				}
+			} finally {
+				apr.close();
 			}
-			apr.close();
 		}
 		return ret;
 	}
-- 
1.6.0.3.640.g6331a

^ permalink raw reply related

* Re: [PATCH] Modified the default git help message to be grouped by topic
From: Boyd Stephen Smith Jr. @ 2008-12-02 21:33 UTC (permalink / raw)
  To: git; +Cc: James Pickens, Scott Chacon, Junio C Hamano, Jeff King
In-Reply-To: <885649360812021211u3d547982i8e1c3070972363e8@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1254 bytes --]

On Tuesday 02 December 2008, "James Pickens" <jepicken@gmail.com> wrote 
about 'Re: [PATCH] Modified the default git help message to be grouped by 
topic':
>On Mon, Dec 1, 2008 at 11:10 PM, Scott Chacon <schacon@gmail.com> wrote:
>> I sent a new patch that removes 'rm' and 'mv' and removes the
>> common-cmd.h build process. I did keep the 'status' command, since in
>> my personal experience people tend to like having that command.
>
>Even though 'rm' might not be used very often, I think it's an important
>enough command that it should not be removed from the 'basics' list.
>AFAIK, the only other way to delete a file is 'rm file' followed by 'git
>add -u' or 'git commit -a'.  Imagine a git newbie trying to figure that
>out.
>
>I'm tempted to say the same thing about 'mv' as well.  And FWIW, I use
>'status' a lot more than I use 'diff', so I would vote to keep 'status'
> in the list too.

x2 to all of both paragraphs, except that I'm not just "tempted"; I do say 
that mv should be kept.
-- 
Boyd Stephen Smith Jr.                     ,= ,-_-. =. 
bss03@volumehost.net                      ((_/)o o(\_))
ICQ: 514984 YM/AIM: DaTwinkDaddy           `-'(. .)`-' 
http://iguanasuicide.org/                      \_/     

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 197 bytes --]

^ permalink raw reply

* git-svn with multiple remote repositories?
From: Josef Wolf @ 2008-12-02 21:39 UTC (permalink / raw)
  To: git

Hello,

I am trying to create a git repository with two remote svn repositories
so that I can merge/move patch-sets back and forth between the svn
repositories.

This is what I have tried so far:

  mkdir -p project
  cd project
  git-svn init -R private -s https://foo.bar/repos/private

Then I go and edit .git/config too look like this:

  [core]
          repositoryformatversion = 0
          filemode = true
          bare = false
          logallrefupdates = true
  [svn-remote "private"]
          url       =   https://foo.bar/repos/private
          fetch     =      trunk:refs/remotes/private/trunk
          branches  = branches/*:refs/remotes/private/*
          tags      =     tags/*:refs/remotes/private/tags/*
  [svn-remote "public"]
          url       =   https://foo.bar/repos/public
          fetch     =      trunk:refs/remotes/public/trunk
          branches  = branches/*:refs/remotes/public/*
          tags      =     tags/*:refs/remotes/public/tags/*

And finally, I do

  git-svn fetch -R private
  git-svn fetch -R public

Both commands seem to fetch the contents from their origins.  But
git-branch shows me only the local master branch with contents from
the "private" svn repository.  When I do

  git checkout public/trunk

the contents actually change to reflect the "public" svn repository,
but git-branch says I am on "(no branch)" at all.

As a newbie to git, I am somewhat confused now.  Any hints how I can
get a hold on the remote branches merge between them?

^ permalink raw reply

* [JGIT PATCH 2/2 v2] Improve closing of files in error situations.
From: Robin Rosenberg @ 2008-12-02 21:41 UTC (permalink / raw)
  To: spearce; +Cc: git, Robin Rosenberg
In-Reply-To: <1228252816-5987-2-git-send-email-robin.rosenberg@dewire.com>

Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
---
 .../exttst/org/spearce/jgit/lib/SpeedTestBase.java |   12 +++++--
 .../dircache/DirCacheCGitCompatabilityTest.java    |   24 ++++++++++-----
 .../org/spearce/jgit/lib/RepositoryTestCase.java   |   27 +++++++++++------
 .../src/org/spearce/jgit/lib/GitIndex.java         |    2 +-
 .../src/org/spearce/jgit/lib/Repository.java       |   31 +++++++++++++-------
 5 files changed, 63 insertions(+), 33 deletions(-)

I was a bit quick there. This is an extended version of patch 2/2.

-- robin

diff --git a/org.spearce.jgit.test/exttst/org/spearce/jgit/lib/SpeedTestBase.java b/org.spearce.jgit.test/exttst/org/spearce/jgit/lib/SpeedTestBase.java
index 11f7439..36a5e0e 100644
--- a/org.spearce.jgit.test/exttst/org/spearce/jgit/lib/SpeedTestBase.java
+++ b/org.spearce.jgit.test/exttst/org/spearce/jgit/lib/SpeedTestBase.java
@@ -72,10 +72,14 @@
 	protected void prepare(String[] refcmd) throws Exception {
 		try {
 			BufferedReader bufferedReader = new BufferedReader(new FileReader("kernel.ref"));
-			kernelrepo = bufferedReader.readLine();
-			bufferedReader.close();
-			timeNativeGit(kernelrepo, refcmd);
-			nativeTime = timeNativeGit(kernelrepo, refcmd);
+			try {
+				kernelrepo = bufferedReader.readLine();
+				bufferedReader.close();
+				timeNativeGit(kernelrepo, refcmd);
+				nativeTime = timeNativeGit(kernelrepo, refcmd);
+			} finally {
+				bufferedReader.close();
+			}
 		} catch (Exception e) {
 			System.out.println("Create a file named kernel.ref and put the path to the Linux kernels repository there");
 			throw e;
diff --git a/org.spearce.jgit.test/tst/org/spearce/jgit/dircache/DirCacheCGitCompatabilityTest.java b/org.spearce.jgit.test/tst/org/spearce/jgit/dircache/DirCacheCGitCompatabilityTest.java
index b052686..42832fe 100644
--- a/org.spearce.jgit.test/tst/org/spearce/jgit/dircache/DirCacheCGitCompatabilityTest.java
+++ b/org.spearce.jgit.test/tst/org/spearce/jgit/dircache/DirCacheCGitCompatabilityTest.java
@@ -146,10 +146,14 @@ private File pathOf(final String name) {
 		final LinkedHashMap<String, CGitIndexRecord> r = new LinkedHashMap<String, CGitIndexRecord>();
 		final BufferedReader br = new BufferedReader(new InputStreamReader(
 				new FileInputStream(pathOf("gitgit.lsfiles")), "UTF-8"));
-		String line;
-		while ((line = br.readLine()) != null) {
-			final CGitIndexRecord cr = new CGitIndexRecord(line);
-			r.put(cr.path, cr);
+		try {
+			String line;
+			while ((line = br.readLine()) != null) {
+				final CGitIndexRecord cr = new CGitIndexRecord(line);
+				r.put(cr.path, cr);
+			}
+		} finally {
+			br.close();
 		}
 		return r;
 	}
@@ -158,10 +162,14 @@ private File pathOf(final String name) {
 		final LinkedHashMap<String, CGitLsTreeRecord> r = new LinkedHashMap<String, CGitLsTreeRecord>();
 		final BufferedReader br = new BufferedReader(new InputStreamReader(
 				new FileInputStream(pathOf("gitgit.lstree")), "UTF-8"));
-		String line;
-		while ((line = br.readLine()) != null) {
-			final CGitLsTreeRecord cr = new CGitLsTreeRecord(line);
-			r.put(cr.path, cr);
+		try {
+			String line;
+			while ((line = br.readLine()) != null) {
+				final CGitLsTreeRecord cr = new CGitLsTreeRecord(line);
+				r.put(cr.path, cr);
+			}
+		} finally {
+			br.close();
 		}
 		return r;
 	}
diff --git a/org.spearce.jgit.test/tst/org/spearce/jgit/lib/RepositoryTestCase.java b/org.spearce.jgit.test/tst/org/spearce/jgit/lib/RepositoryTestCase.java
index 22bf395..8937145 100644
--- a/org.spearce.jgit.test/tst/org/spearce/jgit/lib/RepositoryTestCase.java
+++ b/org.spearce.jgit.test/tst/org/spearce/jgit/lib/RepositoryTestCase.java
@@ -152,14 +152,20 @@ private static void reportDeleteFailure(final String name,
 	protected static void copyFile(final File src, final File dst)
 			throws IOException {
 		final FileInputStream fis = new FileInputStream(src);
-		final FileOutputStream fos = new FileOutputStream(dst);
-		final byte[] buf = new byte[4096];
-		int r;
-		while ((r = fis.read(buf)) > 0) {
-			fos.write(buf, 0, r);
+		try {
+			final FileOutputStream fos = new FileOutputStream(dst);
+			try {
+				final byte[] buf = new byte[4096];
+				int r;
+				while ((r = fis.read(buf)) > 0) {
+					fos.write(buf, 0, r);
+				}
+			} finally {
+				fos.close();
+			}
+		} finally {
+			fis.close();
 		}
-		fis.close();
-		fos.close();
 	}
 
 	protected File writeTrashFile(final String name, final String data)
@@ -170,8 +176,11 @@ protected File writeTrashFile(final String name, final String data)
 			throw new Error("Could not create directory " + tf.getParentFile());
 		final OutputStreamWriter fw = new OutputStreamWriter(
 				new FileOutputStream(tf), "UTF-8");
-		fw.write(data);
-		fw.close();
+		try {
+			fw.write(data);
+		} finally {
+			fw.close();
+		}
 		return tf;
 	}
 
diff --git a/org.spearce.jgit/src/org/spearce/jgit/lib/GitIndex.java b/org.spearce.jgit/src/org/spearce/jgit/lib/GitIndex.java
index bafddef..7ff6754 100644
--- a/org.spearce.jgit/src/org/spearce/jgit/lib/GitIndex.java
+++ b/org.spearce.jgit/src/org/spearce/jgit/lib/GitIndex.java
@@ -547,8 +547,8 @@ public boolean isModified(File wd, boolean forceContentCheck) {
 
 				try {
 					InputStream is = new FileInputStream(file);
-					ObjectWriter objectWriter = new ObjectWriter(db);
 					try {
+						ObjectWriter objectWriter = new ObjectWriter(db);
 						ObjectId newId = objectWriter.computeBlobSha1(file
 								.length(), is);
 						boolean ret = !newId.equals(sha1);
diff --git a/org.spearce.jgit/src/org/spearce/jgit/lib/Repository.java b/org.spearce.jgit/src/org/spearce/jgit/lib/Repository.java
index b54afd5..da1494f 100644
--- a/org.spearce.jgit/src/org/spearce/jgit/lib/Repository.java
+++ b/org.spearce.jgit/src/org/spearce/jgit/lib/Repository.java
@@ -144,10 +144,13 @@ public Repository(final File d) throws IOException {
 		final File altFile = FS.resolve(objectsDir, "info/alternates");
 		if (altFile.exists()) {
 			BufferedReader ar = new BufferedReader(new FileReader(altFile));
-			for (String alt=ar.readLine(); alt!=null; alt=ar.readLine()) {
-				readObjectsDirs(FS.resolve(objectsDir, alt), ret);
+			try {
+				for (String alt=ar.readLine(); alt!=null; alt=ar.readLine()) {
+					readObjectsDirs(FS.resolve(objectsDir, alt), ret);
+				}
+			} catch (Exception e) {
+				ar.close();
 			}
-			ar.close();
 		}
 		return ret;
 	}
@@ -1027,15 +1030,21 @@ public boolean isStGitMode() {
 		if (isStGitMode()) {
 			File patchDir = new File(new File(getDirectory(),"patches"),getBranch());
 			BufferedReader apr = new BufferedReader(new FileReader(new File(patchDir,"applied")));
-			for (String patchName=apr.readLine(); patchName!=null; patchName=apr.readLine()) {
-				File topFile = new File(new File(new File(patchDir,"patches"), patchName), "top");
-				BufferedReader tfr = new BufferedReader(new FileReader(topFile));
-				String objectId = tfr.readLine();
-				ObjectId id = ObjectId.fromString(objectId);
-				ret.put(id, new StGitPatch(patchName, id));
-				tfr.close();
+			try {
+				for (String patchName=apr.readLine(); patchName!=null; patchName=apr.readLine()) {
+					File topFile = new File(new File(new File(patchDir,"patches"), patchName), "top");
+					BufferedReader tfr = new BufferedReader(new FileReader(topFile));
+					try {
+						String objectId = tfr.readLine();
+						ObjectId id = ObjectId.fromString(objectId);
+						ret.put(id, new StGitPatch(patchName, id));
+					} finally {
+						tfr.close();
+					}
+				}
+			} finally {
+				apr.close();
 			}
-			apr.close();
 		}
 		return ret;
 	}
-- 
1.6.0.3.640.g6331a

^ permalink raw reply related

* Re: [PATCH] git-svn: Make branch use correct svn-remote
From: Eric Wong @ 2008-12-02 21:51 UTC (permalink / raw)
  To: Deskin Miller; +Cc: git, gitster
In-Reply-To: <1228185780-22938-1-git-send-email-deskinm@umich.edu>

Deskin Miller <deskinm@umich.edu> wrote:
> The 'branch' subcommand incorrectly had the svn-remote to use hardcoded
> as 'svn', the default remote name.  This meant that branches derived
> from other svn-remotes would try to use the branch and tag configuration
> for the 'svn' remote, potentially copying would-be branches to the wrong
> place in SVN, into the branch namespace for another project.
> 
> Fix this by using the remote name extracted from the svn info for the
> specified git ref.  Add a testcase for this behaviour.
> 
> Signed-off-by: Deskin Miller <deskinm@umich.edu>

Looks alright to me, thanks Deskin.

Acked-by: Eric Wong <normalperson@yhbt.net>

> ---
> Applies on v1.6.1-rc1.  Apologies for not catching this when first
> writing testcases for the branch subcommand.
> 
> Deskin Miller
> 
>  git-svn.perl                  |    2 +-
>  t/t9128-git-svn-cmd-branch.sh |   17 +++++++++++++++++
>  2 files changed, 18 insertions(+), 1 deletions(-)
> 
> diff --git a/git-svn.perl b/git-svn.perl
> index 914c707..e64e97b 100755
> --- a/git-svn.perl
> +++ b/git-svn.perl
> @@ -558,7 +558,7 @@ sub cmd_branch {
>  
>  	my ($src, $rev, undef, $gs) = working_head_info($head);
>  
> -	my $remote = Git::SVN::read_all_remotes()->{svn};
> +	my $remote = Git::SVN::read_all_remotes()->{$gs->{repo_id}};
>  	my $glob = $remote->{ $_tag ? 'tags' : 'branches' };
>  	my ($lft, $rgt) = @{ $glob->{path} }{qw/left right/};
>  	my $dst = join '/', $remote->{url}, $lft, $branch_name, ($rgt || ());
> diff --git a/t/t9128-git-svn-cmd-branch.sh b/t/t9128-git-svn-cmd-branch.sh
> index 47c4d4d..e2b6696 100755
> --- a/t/t9128-git-svn-cmd-branch.sh
> +++ b/t/t9128-git-svn-cmd-branch.sh
> @@ -56,4 +56,21 @@ test_expect_success 'git svn branch tests' '
>  	test_must_fail git svn tag tag1
>  '
>  
> +test_expect_success 'branch uses correct svn-remote' '
> +	(svn co "$svnrepo" svn &&
> +	cd svn &&
> +	mkdir mirror &&
> +	svn add mirror &&
> +	svn copy trunk tags branches mirror/ &&
> +	svn ci -m "made mirror" ) &&
> +	rm -rf svn &&
> +	git svn init -s -R mirror --prefix=mirror/ "$svnrepo"/mirror &&
> +	git svn fetch -R mirror &&
> +	git checkout mirror/trunk &&
> +	base=$(git rev-parse HEAD:) &&
> +	git svn branch -m "branch in mirror" d &&
> +	test $base = $(git rev-parse remotes/mirror/d:) &&
> +	test_must_fail git rev-parse remotes/d
> +'
> +
>  test_done
> -- 
> 1.6.1.rc1

^ permalink raw reply

* Re: [PATCH] gitweb: fixes to gitweb feature check code
From: Junio C Hamano @ 2008-12-02 21:55 UTC (permalink / raw)
  To: Jakub Narebski; +Cc: Giuseppe Bilotta, git, Petr Baudis
In-Reply-To: <200812020253.09430.jnareb@gmail.com>

Jakub Narebski <jnareb@gmail.com> writes:

> What I like about having all this, i.e. fix, futureproof and style
> correction in one single patch is the fact that fix doesn't introduce
> strange looking (gitweb_check_feature('bool_feat'))[0]... well, except
> encapsulated in a subroutine.
>
> From all possible splits of this feature into series of up to three
> patches I think I like the one with pure subroutine rename from *check*
> to *get* least...

Well, I have to say that you have a strange taste, sense of priorities,
and perhaps aversion to logical progression.  Let's explain one more
time.

The case we had at hand was that a callee has a less-than-ideal calling
convention that has caused a few bugs by callers because they did not
understand the calling convention.  You can argue it is not entirely
caller's fault that they failed to follow the calling convention, but the
fact remains that there are bugs taken as a whole.

First we fix the callers, because existing bugs get highest priority.
This is a pure bugfix patch that could even go to maintenance "bugfix
only" branch.

Then we fix the calling convention because we all know that the calling
convention was less-than-ideal.  A large part of the reason the calling
convention was confusing was because the wording "check" implied it was a
boolean function.  Logically, s/check/get/ would be a major part of fixing
that.

After calling convention is enhanced by a new function that lets callers
"check" via a boolean function, we can have them use that, which makes
them easier to read.

But remember that it is the order I wanted the patches to be presented for
review.  After people involved in review agree that the result is good, I
do not have any problem in squashing the three steps into a single patch
for things like this after the end result is verified to be good (which we
did).

^ permalink raw reply

* git-p4 submit, Can't clobber writable file
From: Gary Yang @ 2008-12-02 22:30 UTC (permalink / raw)
  To: git


I followed the instructions at http://modular.math.washington.edu/home/mhansen/git-1.5.5.1/contrib/fast-import/git-p4.txt

But, I am not able to git-p4 submit. Any idea?

git-p4 clone //build/scripts build_scripts
cd build_scripts
vi foo.h
git commit foo.h
git-p4 rebase
git-p4 submit

  from sets import Set;
Perforce checkout for depot path //build/scripts/ located at /home/gyang/workspace/build_scripts/
Syncronizing p4 checkout...
//build/scripts/foo.h#1 - added as /home/gyang/workspace/build_scripts/foo.h
Can't clobber writable file /home/gyang/workspace/build_scripts/foo.h
//build/scripts/foo.c#1 - added as /home/gyang/workspace/build_scripts/foo.c
Can't clobber writable file /user/home/gyang/workspace/build_scripts/foo.c
......
command failed: p4 sync ...

Thanks.





      

^ permalink raw reply

* Re: [PATCH] Modified the default git help message to be grouped by topic
From: Johannes Schindelin @ 2008-12-02 22:55 UTC (permalink / raw)
  To: James Pickens; +Cc: Scott Chacon, Junio C Hamano, Jeff King, git
In-Reply-To: <885649360812021211u3d547982i8e1c3070972363e8@mail.gmail.com>

Hi,

On Tue, 2 Dec 2008, James Pickens wrote:

> On Mon, Dec 1, 2008 at 11:10 PM, Scott Chacon <schacon@gmail.com> wrote:
>
> > On Mon, Dec 1, 2008 at 5:45 PM, Junio C Hamano <gitster@pobox.com> wrote:
> >> If this list is meant to show "the most commonly used" basics, then 
> >> you can trim the list somewhat.  For example, "rm" and "mv" can be 
> >> safely discarded, "status" can be replaced with "diff", and "diff" 
> >> can be removed from "History Commands".
> >
> > I sent a new patch that removes 'rm' and 'mv' and removes the 
> > common-cmd.h build process. I did keep the 'status' command, since in 
> > my personal experience people tend to like having that command.
> 
> Even though 'rm' might not be used very often, I think it's an important 
> enough command that it should not be removed from the 'basics' list. 
> AFAIK, the only other way to delete a file is 'rm file' followed by 'git 
> add -u' or 'git commit -a'.  Imagine a git newbie trying to figure that 
> out.
> 
> I'm tempted to say the same thing about 'mv' as well.  And FWIW, I use 
> 'status' a lot more than I use 'diff', so I would vote to keep 'status' 
> in the list too.

If the whole thing gets longer than 24 lines, we have to leave some things 
out.  Personally, I consider rm and mv unimportant enough that they could 
be shown in an extended list, but be left out of the summary page.

Ciao,
Dscho

^ permalink raw reply

* Re: [PATCH] User's Manual: remove duplicated url at the end of Appendix B
From: J. Bruce Fields @ 2008-12-02 23:06 UTC (permalink / raw)
  To: Miklos Vajna; +Cc: Junio C Hamano, git
In-Reply-To: <1228157402-10961-1-git-send-email-vmiklos@frugalware.org>

On Mon, Dec 01, 2008 at 07:50:02PM +0100, Miklos Vajna wrote:
> Signed-off-by: Miklos Vajna <vmiklos@frugalware.org>

Oops, clearly correct, thanks.--b.

> ---
>  Documentation/user-manual.txt |    1 -
>  1 files changed, 0 insertions(+), 1 deletions(-)
> 
> diff --git a/Documentation/user-manual.txt b/Documentation/user-manual.txt
> index da9c6b2..9f527d3 100644
> --- a/Documentation/user-manual.txt
> +++ b/Documentation/user-manual.txt
> @@ -4572,4 +4572,3 @@ Alternates, clone -reference, etc.
>  More on recovery from repository corruption.  See:
>  	http://marc.theaimsgroup.com/?l=git&m=117263864820799&w=2
>  	http://marc.theaimsgroup.com/?l=git&m=117147855503798&w=2
> -	http://marc.theaimsgroup.com/?l=git&m=117147855503798&w=2
> -- 
> 1.6.0.4
> 

^ permalink raw reply

* Re: git-svn with multiple remote repositories?
From: Jacob Helwig @ 2008-12-02 23:07 UTC (permalink / raw)
  To: Josef Wolf; +Cc: Git
In-Reply-To: <20081202213930.GD12716@raven.wolf.lan>

No branch for your checkout is correct. Try something like: git  
checkout -b foo public/trunk

On Dec 2, 2008, at 13:39, Josef Wolf <jw@raven.inka.de> wrote:

> Hello,
>
> I am trying to create a git repository with two remote svn  
> repositories
> so that I can merge/move patch-sets back and forth between the svn
> repositories.
>
> This is what I have tried so far:
>
>  mkdir -p project
>  cd project
>  git-svn init -R private -s https://foo.bar/repos/private
>
> Then I go and edit .git/config too look like this:
>
>  [core]
>          repositoryformatversion = 0
>          filemode = true
>          bare = false
>          logallrefupdates = true
>  [svn-remote "private"]
>          url       =   https://foo.bar/repos/private
>          fetch     =      trunk:refs/remotes/private/trunk
>          branches  = branches/*:refs/remotes/private/*
>          tags      =     tags/*:refs/remotes/private/tags/*
>  [svn-remote "public"]
>          url       =   https://foo.bar/repos/public
>          fetch     =      trunk:refs/remotes/public/trunk
>          branches  = branches/*:refs/remotes/public/*
>          tags      =     tags/*:refs/remotes/public/tags/*
>
> And finally, I do
>
>  git-svn fetch -R private
>  git-svn fetch -R public
>
> Both commands seem to fetch the contents from their origins.  But
> git-branch shows me only the local master branch with contents from
> the "private" svn repository.  When I do
>
>  git checkout public/trunk
>
> the contents actually change to reflect the "public" svn repository,
> but git-branch says I am on "(no branch)" at all.
>
> As a newbie to git, I am somewhat confused now.  Any hints how I can
> get a hold on the remote branches merge between them?
>
> --
> 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] Modified the default git help message to be grouped by topic
From: Jeff King @ 2008-12-02 23:30 UTC (permalink / raw)
  To: Johannes Schindelin; +Cc: James Pickens, Scott Chacon, Junio C Hamano, git
In-Reply-To: <alpine.DEB.1.00.0812022353410.27091@racer>

On Tue, Dec 02, 2008 at 11:55:03PM +0100, Johannes Schindelin wrote:

> If the whole thing gets longer than 24 lines, we have to leave some things 
> out.  Personally, I consider rm and mv unimportant enough that they could 
> be shown in an extended list, but be left out of the summary page.

For the record, the current output is 26 lines, plus you probably want
to account for 1 line of the user's next shell prompt. So we are 3 lines
over already.

Scott's proposal is about grouping the commands more sensibly. Many of
the complaints are about the length of the output. Maybe we should scrap
having a list of commands altogether and just point at section-specific
documentation, each of which could discuss basic commands related to it.

I think there has been mention of task-oriented documentation pointers
before, and I think this is a place where we would want it.

-Peff

^ permalink raw reply

* Re: [PATCH] gitweb: Optional grouping of projects by category
From: Jakub Narebski @ 2008-12-02 23:36 UTC (permalink / raw)
  To: Sebastien Cevey
  Cc: git, Junio C Hamano, Petr Baudis, Gustavo Sverzut Barbieri
In-Reply-To: <87wsei1uvp.wl%seb@cine7.net>

On Tue, 2 Dec 2008, Sebastien Cevey wrote:

> This adds the GITWEB_GROUP_CATEGORIES option which, if enabled, will
> result in grouping projects by category on the project list page.

Should this really be build time configuration (to set default value)?

> The category is specified for each project by the $GIT_DIR/category file
> or the 'category' variable in its configuration file.
> 
> The feature is inspired from Sham Chukoury's patch for the XMMS2
> gitweb, but has been rewritten for the current gitweb development
> HEAD.
> 
> Thanks to Florian Ragwitz for Perl tips.
> 
> Signed-off-by: Sebastien Cevey <seb@cine7.net>
> ---
> 
> I submitted a previous version of this patch on July 27, but was told
> to wait for the end of the feature freeze.  I submitted it again on
> September 5, but didn't get any reply.  Hope to be luckier this time!

Unfortunately it looks like you hit the edge of feature freeze again.
It is not announced yet, as far as I remember, but we are now at 
1.6.1-pre1.  I'll add this patch to my queue to resubmit after 1.6.1
is released, if it wouldn't be accepted in time.

By the way, there was alternate patch series by Gustavo Sverzut Barbieri
on 29 July 2008 adding categories support to gitweb:
  http://thread.gmane.org/gmane.comp.version-control.git/90553
with live demo at http://staff.get-e.org/
 
> This is a new version of the patch, which has been rebased onto the
> current HEAD of the master branch.
> 
>  Makefile           |    2 +
>  gitweb/README      |   11 +++
>  gitweb/gitweb.css  |    5 ++
>  gitweb/gitweb.perl |  173 +++++++++++++++++++++++++++++++++++-----------------
>  4 files changed, 135 insertions(+), 56 deletions(-)
> 
> diff --git a/Makefile b/Makefile
> index 649cfb8..a8e8bbf 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -211,6 +211,7 @@ GITWEB_EXPORT_OK =
>  GITWEB_STRICT_EXPORT =
>  GITWEB_BASE_URL =
>  GITWEB_LIST =
> +GITWEB_GROUP_CATEGORIES =
>  GITWEB_HOMETEXT = indextext.html
>  GITWEB_CSS = gitweb.css
>  GITWEB_LOGO = git-logo.png
> @@ -1189,6 +1190,7 @@ gitweb/gitweb.cgi: gitweb/gitweb.perl
>  	    -e 's|++GITWEB_STRICT_EXPORT++|$(GITWEB_STRICT_EXPORT)|g' \
>  	    -e 's|++GITWEB_BASE_URL++|$(GITWEB_BASE_URL)|g' \
>  	    -e 's|++GITWEB_LIST++|$(GITWEB_LIST)|g' \
> +	    -e 's|++GITWEB_GROUP_CATEGORIES++|$(GITWEB_GROUP_CATEGORIES)|g' \
>  	    -e 's|++GITWEB_HOMETEXT++|$(GITWEB_HOMETEXT)|g' \
>  	    -e 's|++GITWEB_CSS++|$(GITWEB_CSS)|g' \
>  	    -e 's|++GITWEB_LOGO++|$(GITWEB_LOGO)|g' \

O.K. That is just support for build time configuration of default value
(default configuration).

> diff --git a/gitweb/README b/gitweb/README
> index 825162a..a6f82c5 100644
> --- a/gitweb/README
> +++ b/gitweb/README
> @@ -38,6 +38,11 @@ You can specify the following configuration variables when building GIT:
>     using gitweb" in INSTALL file for gitweb to find out how to generate
>     such file from scan of a directory. [No default, which means use root
>     directory for projects]
> + * GITWEB_GROUP_CATEGORIES
> +   Groups projects by category on the main projects list page if set
> +   to true.  The category of a project is determined by the
> +   $GIT_DIR/category file or the 'category' variable in its
> +   configuration file.  [No default / Not set]
>   * GITWEB_EXPORT_OK
>     Show repository only if this file exists (in repository).  Only
>     effective if this variable evaluates to true.  [No default / Not set]
> @@ -188,6 +193,12 @@ not include variables usually directly set during build):
>     full description is available as 'title' attribute (usually shown on
>     mouseover).  By default set to 25, which might be too small if you
>     use long project descriptions.
> + * $projects_list_group_categories
> +   Enables the grouping of projects by category on the project list page.
> + * $project_list_default_category
> +   Default category for projects for which none is specified.  If set
> +   to the empty string, such projects will remain uncategorized and
> +   listed at the top, above categorized projects.
>   * @git_base_url_list
>     List of git base URLs used for URL to where fetch project from, shown
>     in project summary page.  Full URL is "$git_base_url/$project".

Nice documenting it, but I think you should also update "Per-repository
gitweb configuration" section in gitweb/README and mention category
(file) or gitweb.category repository configuration variable.

> diff --git a/gitweb/gitweb.css b/gitweb/gitweb.css
> index a01eac8..2dd45d6 100644
> --- a/gitweb/gitweb.css
> +++ b/gitweb/gitweb.css
> @@ -264,6 +264,11 @@ td.current_head {
>  	text-decoration: underline;
>  }
>  
> +td.category {
> +	padding-top: 1em;
> +	font-weight: bold;
> +}
> +
>  table.diff_tree span.file_status.new {
>  	color: #008000;
>  }
> diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
> index 933e137..c1bcd96 100755
> --- a/gitweb/gitweb.perl
> +++ b/gitweb/gitweb.perl
> @@ -87,6 +87,13 @@ our $projects_list = "++GITWEB_LIST++";
>  # the width (in characters) of the projects list "Description" column
>  our $projects_list_description_width = 25;
>  
> +# group projects by category on the projects list
> +our $projects_list_group_categories = "++GITWEB_GROUP_CATEGORIES++";
> +
> +# default category if none specified
> +# (leave the empty string for no category)
> +our $project_list_default_category = "";
> +
>  # default order of projects list
>  # valid values are none, project, descr, owner, and age
>  our $default_projects_order = "project";
> @@ -2001,18 +2008,28 @@ sub git_get_path_by_hash {
>  ## ......................................................................
>  ## git utility functions, directly accessing git repository
>  
> -sub git_get_project_description {
> -	my $path = shift;
> +sub git_get_project_config_from_file {
> +	my ($name, $path) = @_;
>  
>  	$git_dir = "$projectroot/$path";
> -	open my $fd, "$git_dir/description"
> -		or return git_get_project_config('description');
> -	my $descr = <$fd>;
> +	open my $fd, "$git_dir/$name"
> +		or return git_get_project_config($name);
> +	my $conf = <$fd>;
>  	close $fd;
> -	if (defined $descr) {
> -		chomp $descr;
> +	if (defined $conf) {
> +		chomp $conf;
>  	}
> -	return $descr;
> +	return $conf;
> +}
> +
> +sub git_get_project_description {
> +	my $path = shift;
> +	return git_get_project_config_from_file('description', $path);
> +}
> +
> +sub git_get_project_category {
> +	my $path = shift;
> +	return git_get_project_config_from_file('category', $path);
>  }

I see you have resurrected (?) here git_get_project_config_from_file.
But I don't think it is correct name for this subroutine: it gets
config from a file in GIT_DIR _or_ from repository config.

Nevertheless nice that you avoided code duplication here.

>  
>  sub git_get_project_ctags {
> @@ -3907,8 +3924,9 @@ sub git_patchset_body {
>  
>  # . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
>  
> -# fills project list info (age, description, owner, forks) for each
> -# project in the list, removing invalid projects from returned list
> +# fills project list info (age, description, owner, category, forks)
> +# for each project in the list, removing invalid projects from
> +# returned list
>  # NOTE: modifies $projlist, but does not remove entries from it
>  sub fill_project_list_info {
>  	my ($projlist, $check_forks) = @_;
> @@ -3931,6 +3949,11 @@ sub fill_project_list_info {
>  		if (!defined $pr->{'owner'}) {
>  			$pr->{'owner'} = git_get_project_owner("$pr->{'path'}") || "";
>  		}
> +		if ($projects_list_group_categories && !defined $pr->{'cat'}) {
> +			my $cat = git_get_project_category($pr->{'path'}) ||
> +			                                   $project_list_default_category;
> +			$pr->{'cat'} = to_utf8($cat);
> +		}
>  		if ($check_forks) {
>  			my $pname = $pr->{'path'};
>  			if (($pname =~ s/\.git$//) &&

O.K., although I wonder if we wouldn't spell key name in full, i.e as
$pr->{'category'}. But I think you follow conventions established
earlier here...

> @@ -3948,6 +3971,19 @@ sub fill_project_list_info {
>  	return @projects;
>  }
>  
> +# returns a hash of categories, containing the list of project
> +# belonging to each category
> +sub build_category_list {

I'm not sure about the name of this subroutine...

> +	my ($projlist) = @_;

I would use 

	my $projlist = shift;

here (or even $projects).

> +	my %categories;
> +
> +	for my $pr (@{ $projlist }) {

I would use simpler

	for my $pr (@$projlist) {

here

> +		push @{$categories{ $pr->{'cat'} }}, $pr;
> +	}
> +
> +	return %categories;
> +}
> +
>  # print 'sort by' <th> element, generating 'sort by $name' replay link
>  # if that order is not selected
>  sub print_sort_th {
> @@ -3964,59 +4000,17 @@ sub print_sort_th {
>  	}
>  }
>  

This chunk looks worse that it really is by accident...

> -sub git_project_list_body {

It would be nice to have description what this subroutine does.

> +sub print_project_rows {
>  	# actually uses global variable $project
> -	my ($projlist, $order, $from, $to, $extra, $no_header) = @_;
> -
> -	my ($check_forks) = gitweb_check_feature('forks');
> -	my @projects = fill_project_list_info($projlist, $check_forks);
> +	my ($projects, $from, $to, $check_forks, $show_ctags) = @_;
>  
> -	$order ||= $default_projects_order;
>  	$from = 0 unless defined $from;
> -	$to = $#projects if (!defined $to || $#projects < $to);
> +	$to = $#$projects if (!defined $to || $#$projects < $to);
>  
> -	my %order_info = (
> -		project => { key => 'path', type => 'str' },
> -		descr => { key => 'descr_long', type => 'str' },
> -		owner => { key => 'owner', type => 'str' },
> -		age => { key => 'age', type => 'num' }
> -	);
> -	my $oi = $order_info{$order};
> -	if ($oi->{'type'} eq 'str') {
> -		@projects = sort {$a->{$oi->{'key'}} cmp $b->{$oi->{'key'}}} @projects;
> -	} else {
> -		@projects = sort {$a->{$oi->{'key'}} <=> $b->{$oi->{'key'}}} @projects;
> -	}
> -
> -	my $show_ctags = gitweb_check_feature('ctags');
> -	if ($show_ctags) {
> -		my %ctags;
> -		foreach my $p (@projects) {
> -			foreach my $ct (keys %{$p->{'ctags'}}) {
> -				$ctags{$ct} += $p->{'ctags'}->{$ct};
> -			}
> -		}
> -		my $cloud = git_populate_project_tagcloud(\%ctags);
> -		print git_show_project_tagcloud($cloud, 64);
> -	}
> -
> -	print "<table class=\"project_list\">\n";
> -	unless ($no_header) {
> -		print "<tr>\n";
> -		if ($check_forks) {
> -			print "<th></th>\n";
> -		}
> -		print_sort_th('project', $order, 'Project');
> -		print_sort_th('descr', $order, 'Description');
> -		print_sort_th('owner', $order, 'Owner');
> -		print_sort_th('age', $order, 'Last Change');
> -		print "<th></th>\n" . # for links
> -		      "</tr>\n";
> -	}
>  	my $alternate = 1;
>  	my $tagfilter = $cgi->param('by_tag');
>  	for (my $i = $from; $i <= $to; $i++) {
> -		my $pr = $projects[$i];
> +		my $pr = $projects->[$i];
>  
>  		next if $tagfilter and $show_ctags and not grep { lc $_ eq lc $tagfilter } keys %{$pr->{'ctags'}};
>  		next if $searchtext and not $pr->{'path'} =~ /$searchtext/
> @@ -4060,6 +4054,73 @@ sub git_project_list_body {
>  		      "</td>\n" .
>  		      "</tr>\n";
>  	}
> +}
> +
> +sub git_project_list_body {
> +	my ($projlist, $order, $from, $to, $extra, $no_header) = @_;
> +
> +	my ($check_forks) = gitweb_check_feature('forks');
> +	my @projects = fill_project_list_info($projlist, $check_forks);
> +
> +	$order ||= $default_projects_order;
> +
> +	my %order_info = (
> +		project => { key => 'path', type => 'str' },
> +		descr => { key => 'descr_long', type => 'str' },
> +		owner => { key => 'owner', type => 'str' },
> +		age => { key => 'age', type => 'num' }
> +	);
> +	my $oi = $order_info{$order};
> +	if ($oi->{'type'} eq 'str') {
> +		@projects = sort {$a->{$oi->{'key'}} cmp $b->{$oi->{'key'}}} @projects;
> +	} else {
> +		@projects = sort {$a->{$oi->{'key'}} <=> $b->{$oi->{'key'}}} @projects;
> +	}
> +
> +	my $show_ctags = gitweb_check_feature('ctags');
> +	if ($show_ctags) {
> +		my %ctags;
> +		foreach my $p (@projects) {
> +			foreach my $ct (keys %{$p->{'ctags'}}) {
> +				$ctags{$ct} += $p->{'ctags'}->{$ct};
> +			}
> +		}
> +		my $cloud = git_populate_project_tagcloud(\%ctags);
> +		print git_show_project_tagcloud($cloud, 64);
> +	}
> +
> +	print "<table class=\"project_list\">\n";
> +	unless ($no_header) {
> +		print "<tr>\n";
> +		if ($check_forks) {
> +			print "<th></th>\n";
> +		}
> +		print_sort_th('project', $order, 'Project');
> +		print_sort_th('descr', $order, 'Description');
> +		print_sort_th('owner', $order, 'Owner');
> +		print_sort_th('age', $order, 'Last Change');
> +		print "<th></th>\n" . # for links
> +		      "</tr>\n";
> +	}
> +
> +	if ($projects_list_group_categories) {
> +		my %categories = build_category_list(\@projects);
> +		foreach my $cat (sort keys %categories) {
> +			unless ($cat eq "") {
> +				print "<tr>\n";
> +				if ($check_forks) {
> +					print "<td></td>\n";
> +				}
> +				print "<td class=\"category\" colspan=\"5\">$cat</td>\n";
> +				print "</tr>\n";
> +			}
> +
> +			print_project_rows($categories{$cat}, $from, $to, $check_forks, $show_ctags);
> +		}

Here is and important issue when adding categories support: how division
into categories interplays with sorting of projects.  I see that you
choose to always sort categories alphabetically, and to sort projects
by given column within categories, instead of (more complicated) sorting
categories by first project (first by given order) in a category.

This I think should be mentioned (at least briefly) in commit message.


Another issue is how categories interplay with limiting number of
projects displayed. Currently it is no issue, because projects list
page is not divided into pages, but I think you didn't address this
in your patch.

> +	} else {
> +		print_project_rows(\@projects, $from, $to, $check_forks, $show_ctags);
> +	}
> +
>  	if (defined $extra) {
>  		print "<tr>\n";
>  		if ($check_forks) {
> -- 
> 1.5.6.5
> 
> 

-- 
Jakub Narebski
Poland

^ permalink raw reply

* Re: [PATCH] Modified the default git help message to be grouped by topic
From: Scott Chacon @ 2008-12-02 23:39 UTC (permalink / raw)
  To: Jeff King; +Cc: Johannes Schindelin, James Pickens, Junio C Hamano, git
In-Reply-To: <20081202233004.GA22379@coredump.intra.peff.net>

Hi,

On Tue, Dec 2, 2008 at 3:30 PM, Jeff King <peff@peff.net> wrote:
> On Tue, Dec 02, 2008 at 11:55:03PM +0100, Johannes Schindelin wrote:
>
>> If the whole thing gets longer than 24 lines, we have to leave some things
>> out.  Personally, I consider rm and mv unimportant enough that they could
>> be shown in an extended list, but be left out of the summary page.
>
> For the record, the current output is 26 lines, plus you probably want
> to account for 1 line of the user's next shell prompt. So we are 3 lines
> over already.
>
> Scott's proposal is about grouping the commands more sensibly. Many of
> the complaints are about the length of the output. Maybe we should scrap
> having a list of commands altogether and just point at section-specific
> documentation, each of which could discuss basic commands related to it.

I've always felt it was helpful to newcomers to have that page there
with the couple dozen commands you might use - mostly in case you've
forgotten what the exact command name was.  Hg does something like 'hg
help' which gives you more commands, but I feel like just having the
quick cheat-sheet is generally really helpful.  If someone just wants
to remember what the command 'checkout' was, I wouldn't want them to
have to go to two places - one to look up what the task document was
and then another to view that.

My $0.02

> I think there has been mention of task-oriented documentation pointers
> before, and I think this is a place where we would want it.
>
> -Peff
>

Scott

^ permalink raw reply

* Re: git-p4 submit, Can't clobber writable file
From: Reece Dunn @ 2008-12-02 23:51 UTC (permalink / raw)
  To: garyyang6; +Cc: git
In-Reply-To: <40586.80065.qm@web37902.mail.mud.yahoo.com>

2008/12/2 Gary Yang <garyyang6@yahoo.com>:
>
> I followed the instructions at http://modular.math.washington.edu/home/mhansen/git-1.5.5.1/contrib/fast-import/git-p4.txt
>
> But, I am not able to git-p4 submit. Any idea?
>
> git-p4 clone //build/scripts build_scripts
> cd build_scripts
> vi foo.h
> git commit foo.h
> git-p4 rebase
> git-p4 submit
>
>  from sets import Set;
> Perforce checkout for depot path //build/scripts/ located at /home/gyang/workspace/build_scripts/
> Syncronizing p4 checkout...

This will be running a `p4 sync ...` command to ensure that the files
are up-to-date.

> //build/scripts/foo.h#1 - added as /home/gyang/workspace/build_scripts/foo.h
> Can't clobber writable file /home/gyang/workspace/build_scripts/foo.h
> //build/scripts/foo.c#1 - added as /home/gyang/workspace/build_scripts/foo.c
> Can't clobber writable file /user/home/gyang/workspace/build_scripts/foo.c
> ......
> command failed: p4 sync ...

Perforce will mark files as readonly when it does a checkout. When you
use `p4 edit` to say you have made changes to the file, Perforce
removes the readonly bit.

What is happening here is that the sync (checkout) command is trying
to write foo.h/c to your build_scripts directory, but because they
already exist there *and* are not readonly, Perforce is producing that
error as it does not want to overwrite any files that have changed
locally.

Not sure what is happening on the git-p4 side, though.

- Reece

^ permalink raw reply

* Re: [PATCH] Modified the default git help message to be grouped by topic
From: Junio C Hamano @ 2008-12-03  0:10 UTC (permalink / raw)
  To: Jeff King; +Cc: Johannes Schindelin, James Pickens, Scott Chacon, git
In-Reply-To: <20081202233004.GA22379@coredump.intra.peff.net>

Jeff King <peff@peff.net> writes:

> On Tue, Dec 02, 2008 at 11:55:03PM +0100, Johannes Schindelin wrote:
>
>> If the whole thing gets longer than 24 lines, we have to leave some things 
>> out.  Personally, I consider rm and mv unimportant enough that they could 
>> be shown in an extended list, but be left out of the summary page.
>
> For the record, the current output is 26 lines, plus you probably want
> to account for 1 line of the user's next shell prompt. So we are 3 lines
> over already.
>
> Scott's proposal is about grouping the commands more sensibly. Many of
> the complaints are about the length of the output. Maybe we should scrap
> having a list of commands altogether and just point at section-specific
> documentation, each of which could discuss basic commands related to it.
>
> I think there has been mention of task-oriented documentation pointers
> before, and I think this is a place where we would want it.

It might not be a bad idea to make this "top page help" into an
interactive hierarchical help topic browser.  You would start a page that
might look like this:

    Bootstrapping -- preparing an area to work in
        init, clone
    Basic -- review, undo and record your changes
        diff, status, checkout <path>, add, reset, commit
    History -- inspect what you have now, and what happened before
        log, blame, grep, show
    Branching and Merging -- build and use alternate histories
	branch, checkout -b, merge, rebase
    Working with Others
	remote, fetch, pull, push

with each of the command and the heading being a "link" (use ncurses for
that).  If you choose the leaf-level command (say, 'diff'), you will get
the git-diff(1) manual page.  If you pick one of the headings, say,
"Basic", you may get a more extended description of commands in the
category, that may include other basic commands not in the front page,
perhaps, like this:

    (review)
    diff HEAD: view what you did since the last commit
    diff: view what you did since you last added
    diff --cached: view what you already added
    status: list what are added and changes yet to be added

    (undo)
    checkout path...: checkout a copy from the staging area
    checkout HEAD path...: checkout a copy from the last commit
    reset: undo earlier "git add" to the staging area
    reset path...: do so only for the named paths

    (record)
    mv path1 path2: move the state of path1 to path2
    rm path2: remove path2
    rm --cached path2: do so without losing the copy in the working tree
    add: add the contents to the staging area
    add -p: do so interactively, hunk by hunk
    commit: record the changes you added to the staging area
    commit path...: record all the changes to the paths, ignoring
    	changes you added to the staging area for other paths.

and again each element can be a "link".

^ permalink raw reply

* Re: git-p4 submit, Can't clobber writable file
From: Gary Yang @ 2008-12-03  0:14 UTC (permalink / raw)
  To: Reece Dunn; +Cc: git
In-Reply-To: <3f4fd2640812021551t5451e6e3i91e6d2694c89e085@mail.gmail.com>

Reece,

I understand your explanation. But, git-p4 submit does not work for me. Are you able to re-produce the problem?

Thanks,

Gary


--- On Tue, 12/2/08, Reece Dunn <msclrhd@googlemail.com> wrote:

> From: Reece Dunn <msclrhd@googlemail.com>
> Subject: Re: git-p4 submit, Can't clobber writable file
> To: garyyang6@yahoo.com
> Cc: git@vger.kernel.org
> Date: Tuesday, December 2, 2008, 3:51 PM
> 2008/12/2 Gary Yang <garyyang6@yahoo.com>:
> >
> > I followed the instructions at
> http://modular.math.washington.edu/home/mhansen/git-1.5.5.1/contrib/fast-import/git-p4.txt
> >
> > But, I am not able to git-p4 submit. Any idea?
> >
> > git-p4 clone //build/scripts build_scripts
> > cd build_scripts
> > vi foo.h
> > git commit foo.h
> > git-p4 rebase
> > git-p4 submit
> >
> >  from sets import Set;
> > Perforce checkout for depot path //build/scripts/
> located at /home/gyang/workspace/build_scripts/
> > Syncronizing p4 checkout...
> 
> This will be running a `p4 sync ...` command to ensure that
> the files
> are up-to-date.
> 
> > //build/scripts/foo.h#1 - added as
> /home/gyang/workspace/build_scripts/foo.h
> > Can't clobber writable file
> /home/gyang/workspace/build_scripts/foo.h
> > //build/scripts/foo.c#1 - added as
> /home/gyang/workspace/build_scripts/foo.c
> > Can't clobber writable file
> /user/home/gyang/workspace/build_scripts/foo.c
> > ......
> > command failed: p4 sync ...
> 
> Perforce will mark files as readonly when it does a
> checkout. When you
> use `p4 edit` to say you have made changes to the file,
> Perforce
> removes the readonly bit.
> 
> What is happening here is that the sync (checkout) command
> is trying
> to write foo.h/c to your build_scripts directory, but
> because they
> already exist there *and* are not readonly, Perforce is
> producing that
> error as it does not want to overwrite any files that have
> changed
> locally.
> 
> Not sure what is happening on the git-p4 side, though.
> 
> - Reece


      

^ permalink raw reply

* Re: [PATCH] Modified the default git help message to be grouped by topic
From: Jeff King @ 2008-12-03  0:37 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Johannes Schindelin, James Pickens, Scott Chacon, git
In-Reply-To: <7vfxl6m84g.fsf@gitster.siamese.dyndns.org>

On Tue, Dec 02, 2008 at 04:10:07PM -0800, Junio C Hamano wrote:

> It might not be a bad idea to make this "top page help" into an
> interactive hierarchical help topic browser.  You would start a page that
> might look like this:
> 
>     Bootstrapping -- preparing an area to work in
>         init, clone
>     Basic -- review, undo and record your changes
>         diff, status, checkout <path>, add, reset, commit
>     History -- inspect what you have now, and what happened before
>         log, blame, grep, show
>     Branching and Merging -- build and use alternate histories
> 	branch, checkout -b, merge, rebase
>     Working with Others
> 	remote, fetch, pull, push

Yes, that is the sort of thing I was thinking of. And I think your
layout addresses Scott's concern, which is to keep names of commands
available for quick reference. So really we are ditching the
descriptions.

> with each of the command and the heading being a "link" (use ncurses for
> that).  If you choose the leaf-level command (say, 'diff'), you will get

I'm not sure we need anything so fancy. I was thinking of something
like:

  Bootstrapping -- preparing an area to work in (bootstrapping)
    init, clone
  ...
  Working with Others (others)
    remote, fetch, pull, push

  Use "git help <subject>" for more help on one of these subjects, or
  "git help <command>" for help with a specific command.

And maybe the "(bootstrapping)" could be typographically more obvious as
the subject keyword, but I think you get the point (and for
"Bootstrapping", it's obvious what the keyword would be, but for
"Working with Others" it's not).

And obviously something with ncurses would save you typing, but I have
no desire to recreate "info" or "lynx" here (and I also think that "git"
or "git foo" displaying help should remain non-interactive to cause the
least surprise).

-Peff

^ permalink raw reply

* Re: [PATCH] Modified the default git help message to be grouped by topic
From: Jakub Narebski @ 2008-12-03  0:47 UTC (permalink / raw)
  To: git
In-Reply-To: <7vfxl6m84g.fsf@gitster.siamese.dyndns.org>

Junio C Hamano wrote:

> Jeff King <peff@peff.net> writes:
> 
>> On Tue, Dec 02, 2008 at 11:55:03PM +0100, Johannes Schindelin wrote:
>>
>>> If the whole thing gets longer than 24 lines, we have to leave some things 
>>> out.  Personally, I consider rm and mv unimportant enough that they could 
>>> be shown in an extended list, but be left out of the summary page.
>>
>> For the record, the current output is 26 lines, plus you probably want
>> to account for 1 line of the user's next shell prompt. So we are 3 lines
>> over already.
>>
>> Scott's proposal is about grouping the commands more sensibly. Many of
>> the complaints are about the length of the output. Maybe we should scrap
>> having a list of commands altogether and just point at section-specific
>> documentation, each of which could discuss basic commands related to it.
>>
>> I think there has been mention of task-oriented documentation pointers
>> before, and I think this is a place where we would want it.
> 
> It might not be a bad idea to make this "top page help" into an
> interactive hierarchical help topic browser.

Isn't that info?

-- 
Jakub Narebski
Warsaw, Poland
ShadeHawk on #git

^ permalink raw reply

* Re: more merge strategies : feature request
From: Leo Razoumov @ 2008-12-03  1:07 UTC (permalink / raw)
  To: Caleb Cushing; +Cc: git
In-Reply-To: <81bfc67a0812020546o79906a20jcd04bd42d18dd803@mail.gmail.com>

On 12/2/08, Caleb Cushing <xenoterracide@gmail.com> wrote:
> > I guess that "no-overwrite" can be achieved by
>  >
>  >  git merge -s ours --no-commit
>
>
> no it doesn't. which is why I called it a bad name. no-overwrite would
>  still add new lines to the file not in ours (and no-commit isn't
>  needed in that case) it just wouldn't overwrite conflicting lines, my
>  understanding of ours is that it will keep the files as is.
>
> Caleb Cushing
>

>From your original email in this thread

"no-overwrite: if a change from the branch being merged in would
overwrite something in the current branch don't merge it. (I think it
needs a better name)"

I got the impression that you would like to preserve "ours" branch
whenever other branch tries to overwrite something? Is it
"no-override-conflicting-lines" that you are really after?

--Leo--

^ 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