* Re: [PATCH v2] make diff --color-words customizable
From: Davide Libenzi @ 2009-01-10 17:53 UTC (permalink / raw)
To: Jakub Narebski; +Cc: Johannes Schindelin, git, Thomas Rast
In-Reply-To: <200901101436.48149.jnareb@gmail.com>
On Sat, 10 Jan 2009, Jakub Narebski wrote:
> On Sat, 10 Jan 2009, Johannes Schindelin wrote:
> > On Sat, 10 Jan 2009, Jakub Narebski wrote:
> > > Thomas Rast wrote:
> > >
> > > > --color-words works (and always worked) by splitting words onto one
> > > > line each, and using the normal line-diff machinery to get a word
> > > > diff.
> > >
> > > Cannot we generalize diff machinery / use underlying LCS diff engine
> > > instead of going through line diff?
> >
> > What do you think we're doing? libxdiff is pretty hardcoded to newlines.
> > That's why we're substituting non-word characters with newlines.
>
> Isn't Meyers algorithm used by libxdiff based on LCS, largest common
> subsequence, and doesn't it generate from the mathematical point of
> view "diff" between two sequences (two arrays) which just happen to
> be lines? It is a bit strange that libxdiff doesn't export its low
> level algorithm...
The core doesn't know anything about lines. Only pre-processing (setting
up the hash by tokenizing the input) and post-processing (adding '\n' to
the end of each token), knows about newlines. Memory consumption would
increase significantly though, since there is a per-token cost, and a
word-based diff will create more of them WRT the same input.
- Davide
^ permalink raw reply
* [PATCH] git-cache-meta -- file owner and permissions caching, minimalist approach
From: jidanni @ 2009-01-10 17:43 UTC (permalink / raw)
To: gitster; +Cc: git
In-Reply-To: <200901082229.46433.bss@iguanasuicide.net>
Signed-off-by: jidanni <jidanni@jidanni.org>
---
contrib/metadata/git-cache-meta | 19 +++++++++++++++++++
1 files changed, 19 insertions(+), 0 deletions(-)
create mode 100755 contrib/metadata/git-cache-meta
diff --git a/contrib/metadata/git-cache-meta b/contrib/metadata/git-cache-meta
new file mode 100755
index 0000000..5e1b740
--- /dev/null
+++ b/contrib/metadata/git-cache-meta
@@ -0,0 +1,19 @@
+#!/bin/sh -e
+# git-cache-meta -- file owner and permissions caching, minimalist approach
+: ${GIT_CACHE_META_FILE=.git_cache_meta} #simpler not to git-add it
+case $@ in
+ --store|--stdout)
+ case $1 in --store) exec > $GIT_CACHE_META_FILE; esac
+ git ls-files|xargs -I{} find {} \
+ \( -user ${USER?} -o -printf "chown %u '%p'\n" \) \
+ \( -group $USER -o -printf "chgrp %g '%p'\n" \) \
+ \( \( -type l -o -perm 755 -o -perm 644 \) \
+ -o -printf "chmod %#m '%p'\n" \);;#requires GNU Find
+ --apply) sh -e $GIT_CACHE_META_FILE;;
+ *) 1>&2 cat <<EOF; exit 1;;
+Usage: $0 --store|--stdout|--apply #Example:
+# git bundle create mybundle.bdl master; git-cache-meta --store
+# scp mybundle.bdl .git_cache_meta machine2: #then on machine2:
+# git init; git pull mybundle.bdl master; git-cache-meta --apply
+EOF
+esac
--
1.6.0.6
^ permalink raw reply related
* [EGIT PATCH] Use text resources for the Commit dialog and add shortcuts.
From: Robin Rosenberg @ 2009-01-10 17:21 UTC (permalink / raw)
To: spearce; +Cc: git, Robin Rosenberg
Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
---
.../src/org/spearce/egit/ui/UIText.java | 75 ++++++++++++++++++++
.../egit/ui/internal/dialogs/CommitDialog.java | 67 +++++++++---------
.../src/org/spearce/egit/ui/uitext.properties | 25 +++++++
3 files changed, 134 insertions(+), 33 deletions(-)
diff --git a/org.spearce.egit.ui/src/org/spearce/egit/ui/UIText.java b/org.spearce.egit.ui/src/org/spearce/egit/ui/UIText.java
index 30122d2..0abb209 100644
--- a/org.spearce.egit.ui/src/org/spearce/egit/ui/UIText.java
+++ b/org.spearce.egit.ui/src/org/spearce/egit/ui/UIText.java
@@ -566,6 +566,81 @@
public static String PushWizard_windowTitleWithDestination;
/** */
+ public static String CommitDialog_AddFileOnDiskToIndex;
+
+ /** */
+ public static String CommitDialog_AddSOB;
+
+ /** */
+ public static String CommitDialog_AmendPreviousCommit;
+
+ /** */
+ public static String CommitDialog_Author;
+
+ /** */
+ public static String CommitDialog_Commit;
+
+ /** */
+ public static String CommitDialog_CommitChanges;
+
+ /** */
+ public static String CommitDialog_CommitMessage;
+
+ /** */
+ public static String CommitDialog_DeselectAll;
+
+ /** */
+ public static String CommitDialog_ErrorInvalidAuthor;
+
+ /** */
+ public static String CommitDialog_ErrorInvalidAuthorSpecified;
+
+ /** */
+ public static String CommitDialog_ErrorMustEnterCommitMessage;
+
+ /** */
+ public static String CommitDialog_ErrorNoItemsSelected;
+
+ /** */
+ public static String CommitDialog_ErrorNoItemsSelectedToBeCommitted;
+
+ /** */
+ public static String CommitDialog_ErrorNoMessage;
+
+ /** */
+ public static String CommitDialog_File;
+
+ /** */
+ public static String CommitDialog_SelectAll;
+
+ /** */
+ public static String CommitDialog_Status;
+
+ /** */
+ public static String CommitDialog_StatusAdded;
+
+ /** */
+ public static String CommitDialog_StatusAddedIndexDiff;
+
+ /** */
+ public static String CommitDialog_StatusModified;
+
+ /** */
+ public static String CommitDialog_StatusModifiedIndexDiff;
+
+ /** */
+ public static String CommitDialog_StatusModifiedNotStaged;
+
+ /** */
+ public static String CommitDialog_StatusRemoved;
+
+ /** */
+ public static String CommitDialog_StatusRemovedNotStaged;
+
+ /** */
+ public static String CommitDialog_StatusUnknown;
+
+ /** */
public static String ConfirmationPage_cantConnectToAnyTitle;
/** */
diff --git a/org.spearce.egit.ui/src/org/spearce/egit/ui/internal/dialogs/CommitDialog.java b/org.spearce.egit.ui/src/org/spearce/egit/ui/internal/dialogs/CommitDialog.java
index f32112b..fede948 100644
--- a/org.spearce.egit.ui/src/org/spearce/egit/ui/internal/dialogs/CommitDialog.java
+++ b/org.spearce.egit.ui/src/org/spearce/egit/ui/internal/dialogs/CommitDialog.java
@@ -52,6 +52,7 @@
import org.eclipse.swt.widgets.Text;
import org.eclipse.ui.model.WorkbenchLabelProvider;
import org.spearce.egit.core.project.RepositoryMapping;
+import org.spearce.egit.ui.UIText;
import org.spearce.jgit.lib.Constants;
import org.spearce.jgit.lib.GitIndex;
import org.spearce.jgit.lib.PersonIdent;
@@ -92,7 +93,7 @@ public String getColumnText(Object obj, int columnIndex) {
return item.status;
case 1:
- return item.file.getProject().getName() + ": "
+ return item.file.getProject().getName() + ": " //$NON-NLS-1$
+ item.file.getProjectRelativePath();
default:
@@ -118,10 +119,10 @@ public CommitDialog(Shell parentShell) {
@Override
protected void createButtonsForButtonBar(Composite parent) {
- createButton(parent, IDialogConstants.SELECT_ALL_ID, "Select All", false);
- createButton(parent, IDialogConstants.DESELECT_ALL_ID, "Deselect All", false);
+ createButton(parent, IDialogConstants.SELECT_ALL_ID, UIText.CommitDialog_SelectAll, false);
+ createButton(parent, IDialogConstants.DESELECT_ALL_ID, UIText.CommitDialog_DeselectAll, false);
- createButton(parent, IDialogConstants.OK_ID, "Commit", true);
+ createButton(parent, IDialogConstants.OK_ID, UIText.CommitDialog_Commit, true);
createButton(parent, IDialogConstants.CANCEL_ID,
IDialogConstants.CANCEL_LABEL, false);
}
@@ -130,19 +131,19 @@ createButton(parent, IDialogConstants.CANCEL_ID,
Text authorText;
Button amendingButton;
Button signedOffButton;
-
+
CheckboxTableViewer filesViewer;
@Override
protected Control createDialogArea(Composite parent) {
Composite container = (Composite) super.createDialogArea(parent);
- parent.getShell().setText("Commit Changes");
+ parent.getShell().setText(UIText.CommitDialog_CommitChanges);
GridLayout layout = new GridLayout(2, false);
container.setLayout(layout);
Label label = new Label(container, SWT.LEFT);
- label.setText("Commit Message:");
+ label.setText(UIText.CommitDialog_CommitMessage);
label.setLayoutData(GridDataFactory.fillDefaults().span(2, 1).grab(true, false).create());
commitText = new Text(container, SWT.MULTI | SWT.BORDER | SWT.V_SCROLL);
@@ -163,7 +164,7 @@ public void keyPressed(KeyEvent arg0) {
}
});
- new Label(container, SWT.LEFT).setText("Author: ");
+ new Label(container, SWT.LEFT).setText(UIText.CommitDialog_Author);
authorText = new Text(container, SWT.BORDER);
authorText.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).create());
if (author != null)
@@ -186,24 +187,24 @@ public void widgetSelected(SelectionEvent arg0) {
alreadyAdded = true;
String curText = commitText.getText();
if (curText.length() > 0)
- curText += "\n";
+ curText += "\n"; //$NON-NLS-1$
commitText.setText(curText + previousCommitMessage);
}
}
-
+
public void widgetDefaultSelected(SelectionEvent arg0) {
// Empty
}
});
-
- amendingButton.setText("Amend previous commit");
+
+ amendingButton.setText(UIText.CommitDialog_AmendPreviousCommit);
amendingButton.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).span(2, 1).create());
signedOffButton = new Button(container, SWT.CHECK);
signedOffButton.setSelection(signedOff);
- signedOffButton.setText("Add Signed-off-by");
+ signedOffButton.setText(UIText.CommitDialog_AddSOB);
signedOffButton.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).span(2, 1).create());
-
+
Table resourcesTable = new Table(container, SWT.H_SCROLL | SWT.V_SCROLL
| SWT.FULL_SELECTION | SWT.MULTI | SWT.CHECK | SWT.BORDER);
resourcesTable.setLayoutData(GridDataFactory.fillDefaults().hint(600,
@@ -211,12 +212,12 @@ public void widgetDefaultSelected(SelectionEvent arg0) {
resourcesTable.setHeaderVisible(true);
TableColumn statCol = new TableColumn(resourcesTable, SWT.LEFT);
- statCol.setText("Status");
+ statCol.setText(UIText.CommitDialog_Status);
statCol.setWidth(150);
statCol.addSelectionListener(new HeaderSelectionListener(CommitItem.Order.ByStatus));
TableColumn resourceCol = new TableColumn(resourcesTable, SWT.LEFT);
- resourceCol.setText("File");
+ resourceCol.setText(UIText.CommitDialog_File);
resourceCol.setWidth(415);
resourceCol.addSelectionListener(new HeaderSelectionListener(CommitItem.Order.ByFile));
@@ -234,7 +235,7 @@ public void widgetDefaultSelected(SelectionEvent arg0) {
private Menu getContextMenu() {
Menu menu = new Menu(filesViewer.getTable());
MenuItem item = new MenuItem(menu, SWT.PUSH);
- item.setText("Add file on disk to index");
+ item.setText(UIText.CommitDialog_AddFileOnDiskToIndex);
item.addListener(SWT.Selection, new Listener() {
public void handleEvent(Event arg0) {
IStructuredSelection sel = (IStructuredSelection) filesViewer.getSelection();
@@ -271,12 +272,12 @@ public void handleEvent(Event arg0) {
}
}
});
-
+
return menu;
}
private static String getFileStatus(IFile file) {
- String prefix = "Unknown";
+ String prefix = UIText.CommitDialog_StatusUnknown;
try {
RepositoryMapping repositoryMapping = RepositoryMapping
@@ -292,22 +293,22 @@ private static String getFileStatus(IFile file) {
Entry indexEntry = index.getEntry(repoPath);
if (headEntry == null) {
- prefix = "Added";
+ prefix = UIText.CommitDialog_StatusAdded;
if (indexEntry.isModified(repositoryMapping.getWorkDir()))
- prefix = "Added, index diff";
+ prefix = UIText.CommitDialog_StatusAddedIndexDiff;
} else if (indexEntry == null) {
- prefix = "Removed";
+ prefix = UIText.CommitDialog_StatusRemoved;
} else if (headExists
&& !headEntry.getId().equals(indexEntry.getObjectId())) {
- prefix = "Modified";
+ prefix = UIText.CommitDialog_StatusModified;
if (indexEntry.isModified(repositoryMapping.getWorkDir()))
- prefix = "Mod., index diff";
+ prefix = UIText.CommitDialog_StatusModifiedIndexDiff;
} else if (!new File(repositoryMapping.getWorkDir(), indexEntry
.getName()).isFile()) {
- prefix = "Rem., not staged";
+ prefix = UIText.CommitDialog_StatusRemovedNotStaged;
} else if (indexEntry.isModified(repositoryMapping.getWorkDir())) {
- prefix = "Mod., not staged";
+ prefix = UIText.CommitDialog_StatusModifiedNotStaged;
}
} catch (Exception e) {
@@ -331,14 +332,14 @@ public void setCommitMessage(String s) {
this.commitMessage = s;
}
- private String commitMessage = "";
+ private String commitMessage = ""; //$NON-NLS-1$
private String author = null;
private boolean signedOff = false;
private boolean amending = false;
private boolean amendAllowed = true;
private ArrayList<IFile> selectedFiles = new ArrayList<IFile>();
- private String previousCommitMessage = "";
+ private String previousCommitMessage = ""; //$NON-NLS-1$
/**
* Pre-select suggested set of resources to commit
@@ -398,28 +399,28 @@ protected void okPressed() {
author = authorText.getText().trim();
signedOff = signedOffButton.getSelection();
amending = amendingButton.getSelection();
-
+
Object[] checkedElements = filesViewer.getCheckedElements();
selectedFiles.clear();
for (Object obj : checkedElements)
selectedFiles.add(((CommitItem) obj).file);
if (commitMessage.trim().length() == 0) {
- MessageDialog.openWarning(getShell(), "No message", "You must enter a commit message");
+ MessageDialog.openWarning(getShell(), UIText.CommitDialog_ErrorNoMessage, UIText.CommitDialog_ErrorMustEnterCommitMessage);
return;
}
-
+
if (author.length() > 0) {
try {
new PersonIdent(author);
} catch (IllegalArgumentException e) {
- MessageDialog.openWarning(getShell(), "Invalid author", "Invalid author specified. Please use the form:\nA U Thor <author@example.com>");
+ MessageDialog.openWarning(getShell(), UIText.CommitDialog_ErrorInvalidAuthor, UIText.CommitDialog_ErrorInvalidAuthorSpecified);
return;
}
} else author = null;
if (selectedFiles.isEmpty() && !amending) {
- MessageDialog.openWarning(getShell(), "No items selected", "No items are currently selected to be committed.");
+ MessageDialog.openWarning(getShell(), UIText.CommitDialog_ErrorNoItemsSelected, UIText.CommitDialog_ErrorNoItemsSelectedToBeCommitted);
return;
}
super.okPressed();
diff --git a/org.spearce.egit.ui/src/org/spearce/egit/ui/uitext.properties b/org.spearce.egit.ui/src/org/spearce/egit/ui/uitext.properties
index 3819047..3c9a21c 100644
--- a/org.spearce.egit.ui/src/org/spearce/egit/ui/uitext.properties
+++ b/org.spearce.egit.ui/src/org/spearce/egit/ui/uitext.properties
@@ -216,6 +216,31 @@ PushWizard_unexpectedError=Unexpected error occurred.
PushWizard_windowTitleDefault=Push To Another Repositories
PushWizard_windowTitleWithDestination=Push To: {0}
+CommitDialog_AddFileOnDiskToIndex=Add file on &disk to index
+CommitDialog_AddSOB=Add Signed-off-&by
+CommitDialog_AmendPreviousCommit=A&mend previous commit
+CommitDialog_Author=&Author:
+CommitDialog_Commit=&Commit
+CommitDialog_CommitChanges=Commit Changes
+CommitDialog_CommitMessage=Commit &Message:
+CommitDialog_DeselectAll=&Deselect All
+CommitDialog_ErrorInvalidAuthor=Invalid author
+CommitDialog_ErrorInvalidAuthorSpecified=Invalid author specified. Please use the form:\nA U Thor <author@example.com>
+CommitDialog_ErrorMustEnterCommitMessage=You must enter a commit message
+CommitDialog_ErrorNoItemsSelected=No items selected
+CommitDialog_ErrorNoItemsSelectedToBeCommitted=No items are currently selected to be committed.
+CommitDialog_ErrorNoMessage=No message
+CommitDialog_File=File
+CommitDialog_SelectAll=&Select All
+CommitDialog_Status=Status
+CommitDialog_StatusAdded=Added
+CommitDialog_StatusAddedIndexDiff=Added, index diff
+CommitDialog_StatusModified=Modified
+CommitDialog_StatusModifiedIndexDiff=Mod., index diff
+CommitDialog_StatusModifiedNotStaged=Mod., not staged
+CommitDialog_StatusRemoved=Removed
+CommitDialog_StatusRemovedNotStaged=Rem., not staged
+CommitDialog_StatusUnknown=Unknown
ConfirmationPage_cantConnectToAnyTitle=Can't Connect
ConfirmationPage_cantConnectToAny=Can't connect to any URI: {0}
ConfirmationPage_description=Confirm following expected push result.
--
1.6.1.rc3.56.gd0306
^ permalink raw reply related
* [EGIT PATCH] Make SHA-1 selectable using double-click in the commit message viewer.
From: Robin Rosenberg @ 2009-01-10 17:20 UTC (permalink / raw)
To: spearce; +Cc: git, Robin Rosenberg
The default behaviour does not consider a sequence of numbers and letters
to be a word. Installing the DefaultTextDoubleClickStrategy and activating
"plugins" in the textviewer solves the problem.
Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
---
.../ui/internal/history/CommitMessageViewer.java | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/org.spearce.egit.ui/src/org/spearce/egit/ui/internal/history/CommitMessageViewer.java b/org.spearce.egit.ui/src/org/spearce/egit/ui/internal/history/CommitMessageViewer.java
index 76d57bd..d21555c 100644
--- a/org.spearce.egit.ui/src/org/spearce/egit/ui/internal/history/CommitMessageViewer.java
+++ b/org.spearce.egit.ui/src/org/spearce/egit/ui/internal/history/CommitMessageViewer.java
@@ -15,7 +15,9 @@
import java.util.regex.Pattern;
import org.eclipse.core.runtime.ListenerList;
+import org.eclipse.jface.text.DefaultTextDoubleClickStrategy;
import org.eclipse.jface.text.Document;
+import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.TextViewer;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.StyleRange;
@@ -98,6 +100,9 @@ public void mouseDown(final MouseEvent e) {
}
}
});
+ setTextDoubleClickStrategy(new DefaultTextDoubleClickStrategy(),
+ IDocument.DEFAULT_CONTENT_TYPE);
+ activatePlugins();
}
void addCommitNavigationListener(final CommitNavigationListener l) {
--
1.6.1.rc3.56.gd0306
^ permalink raw reply related
* Re: SSH_ASKPASS
From: Changsheng Jiang @ 2009-01-10 17:13 UTC (permalink / raw)
To: Henk; +Cc: git
In-Reply-To: <1231584934701-2137400.post@n2.nabble.com>
Why you don't setup a pair of keys, then you will not need to enter
passwords?
Yours Sincerely,
Changsheng Jiang
On Sat, Jan 10, 2009 at 18:55, Henk <henk_westhuis@hotmail.com> wrote:
>
> Hi,
>
> I'm trying to get "git push" to use git-gui--askpass to ask me for the
> password instead of promting me on the command promt. I need this because I
> start the "git push" command from code and there is no terminal where ssh
> can ask the user for a password. I tried writing the following tcl script
> that allmost is what I need:
>
> set env(SSH_ASKPASS) "C:/Program
> Files/Git/libexec/git-core/git-gui--askpass"
> exec ssh git@github.com
>
> Ssh will now ask me for the password using git-gui--askpass. But now the
> standardout is also shown in a dialog, and not on the standardout of the
> process. Looking at the git-gui scripts didn't help me, because I have
> absolutely zero experience in tcl.
>
> I also tried not using a tcl script, but setting SSH_ASKPASS as an
> environment variable in windows. This doesn't seem to work, ssh will still
> prompt me for a password.
>
> Anyone can help me write a script that asks for the password using
> SSH_ASKPASS but still prints the output on standardout?
>
> I use Windows btw.
>
> Henk
> --
> View this message in context: http://n2.nabble.com/SSH_ASKPASS-tp2137400p2137400.html
> Sent from the git mailing list archive at Nabble.com.
>
> --
> 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
* [PATCH] Add new testcases for format-patch root commits
From: Alexander Potashev @ 2009-01-10 16:39 UTC (permalink / raw)
To: Junio C Hamano; +Cc: Git Mailing List, Alexander Potashev
In-Reply-To: <20090110113903.GB25723@myhost>
1. format-patch'ing root commit shouldn't create empty patches
2. With --root it should create a patch for the root commit
3. Similar testcases with two commits in the tree
Signed-off-by: Alexander Potashev <aspotashev@gmail.com>
---
git format-patch lacks a '--no-root' option, so I used
'git config log.showroot false' to emulate it.
t/t4033-format-patch-root-commit.sh | 52 +++++++++++++++++++++++++++++++++++
1 files changed, 52 insertions(+), 0 deletions(-)
create mode 100755 t/t4033-format-patch-root-commit.sh
diff --git a/t/t4033-format-patch-root-commit.sh b/t/t4033-format-patch-root-commit.sh
new file mode 100755
index 0000000..846c11c
--- /dev/null
+++ b/t/t4033-format-patch-root-commit.sh
@@ -0,0 +1,52 @@
+#!/bin/sh
+
+test_description='Format-patch root commit skipping/allowing'
+
+. ./test-lib.sh
+
+test_expect_success setup '
+ git config log.showroot false
+ git config format.numbered false
+ echo A > file &&
+ git add file &&
+ git commit -m First
+'
+
+test_patch_count() {
+ cnt=$(grep "^Subject: \[PATCH\]" $1 | wc -l) &&
+ test $cnt = $2
+}
+
+test_patch_is_single() {
+ cnt=$(grep "^Subject: \[PATCH\] $2" $1 | wc -l) &&
+ test $cnt = 1
+}
+
+test_expect_success 'format-patch root commit with showroot = false' '
+ git format-patch -1 &&
+ test_must_fail cat 0001-First.patch
+'
+
+test_expect_success 'format-patch root commit' '
+ git format-patch --root --stdout -5 >root-only.patch &&
+ test_patch_count root-only.patch 1 &&
+ test_patch_is_single root-only.patch First
+'
+
+test_expect_success 'format-patch 2 commits without root' '
+ echo B > file &&
+ git commit -a -m Second &&
+
+ git format-patch --stdout -2 >two-except-root.patch &&
+ test_patch_count two-except-root.patch 1 &&
+ test_patch_is_single two-except-root.patch Second
+'
+
+test_expect_success 'format-patch 2 commits including root' '
+ git format-patch --root --stdout -2 >two-with-root.patch &&
+ test_patch_count two-with-root.patch 2 &&
+ test_patch_is_single two-with-root.patch First &&
+ test_patch_is_single two-with-root.patch Second
+'
+
+test_done
--
1.6.1.81.g61cf1
^ permalink raw reply related
* Re: [RFC/PATCH 2/3] replace_object: add mechanism to replace objects found in "refs/replace/"
From: Jakub Narebski @ 2009-01-10 16:30 UTC (permalink / raw)
To: Junio C Hamano; +Cc: Christian Couder, git, Tim Ansell
In-Reply-To: <7v8wpl4akr.fsf@gitster.siamese.dyndns.org>
Junio C Hamano <gitster@pobox.com> writes:
> Christian Couder <chriscool@tuxfamily.org> writes:
>
> > Yeah, but read_sha1_file is called to read all object files, not just
> > commits. So putting the hook there will:
> >
> > 1) add a lookup overhead when reading any object,
> > 2) make it possible to replace any object,
>
> I actually see (2) as an improvement, and (1) as an associated cost.
I just had an idea: we can use this mechanism to better manage large
binary files in Git, by using replacements for _blobs_.
We want to be able to have two flavours of repository: one with large
blobs (media files usually), and one without. We can use stubs in the
place of large binary files in 'no-megablobs' flavor, and add contents
of those files via refs/replace/* for _blobs_ in 'with-megablobs'
flavour. We can control which objects we want to have, and which
objects to transfer.
What do you think about this (abuse of) an idea?
--
Jakub Narebski
Poland
ShadeHawk on #git
^ permalink raw reply
* Re: Main branch being maintained with 'git am', how do mere mortals interact without too much conflicts?
From: Sitaram Chamarty @ 2009-01-10 16:29 UTC (permalink / raw)
To: git
In-Reply-To: <eaa105840901100647y70b53ae0w495af69b7281cae7@mail.gmail.com>
On 2009-01-10, Peter Harris <git@peter.is-a-geek.org> wrote:
> On Sat, Jan 10, 2009 at 6:11 AM, Junichi Uekawa wrote:
>> I am thinking of recommending the users to create a branch
> ...
>> and throw away their branches when they are included upstream.
>
> Yes, with a patch based workflow, this is almost required; all of the
> commits will at least have different committer information.
>
> There's nothing wrong with this approach.
That is almost exactly what a rebase does. Each patch on
your local "master" that eventually made it upstream gets
discarded during the rebase (which is a pretty cool thing!),
and what remains are commits that did not make it upstream
-- their current "work in progress".
The difference between "origin/master" and "master", after
each rebase, is their "private branch".
Except you don't have to confuse them by saying so ;-)
>> Something tells me the problem is that I'm probably using a workflow
>> that resembles SVN too much, and users aren't used to branches yet.
>> Has anybody found this to be a problem, or better yet, is there a
>> better workflow?
>
> If you need the commits to be identical, and you don't mind your email
> consisting of a binary blob attachment, you can ask your contributors
> to send you a bundle instead of a series of patches. "git help bundle"
> for details.
Excellent idea. But it only works for the first user who
sends him a bundle. The next one that he gets, assuming
that user also started from the same "upstream" commit as
the starting point, will be a merge, and he has to resolve
conflicts anyway.
Essentially, two things have to happen to reduce conflict
resolution overall. The users must rebase against the
latest upstream before sending the patch, and the supervisor
must process and push received patches asap.
^ permalink raw reply
* Re: Main branch being maintained with 'git am', how do mere mortals interact without too much conflicts?
From: Sitaram Chamarty @ 2009-01-10 16:18 UTC (permalink / raw)
To: git
In-Reply-To: <87vdsntnyd.dancerj%dancer@netfort.gr.jp>
On 2009-01-10, Junichi Uekawa <dancer@netfort.gr.jp> wrote:
> I've been maintaining my Git repository (monthlyreport.git) where most
> people do not have push access, and I'm taking patches through e-mail
> with 'git am'.
In general, if inputs are bunched up and arrive all
together, there's bound to be conflicts.
> It often happens that I'm receiving patches which won't apply without
> a merge ('git am -3') and happen to be conflict-resolving often,
> because people work off a branch a few days before, and try to send
That's the key phrase, the delay between when they pulled
and when they committed. I'm not sure of the nature of the
data, and how close it is to "source code" but normally this
is a case for a rebase.
If you don't want them to use branches, you can sort of get
away with these changes to your current flow:
> User does
> git pull xxxx
use "git pull --rebase xxxx" instead of plain pull;
resolve conflicts if needed
> edit ...
(I'm assuming there's a long gap between the pull above
and the add below)
> git add
> git commit
git fetch # update from origin
git rebase origin/master
(they may have to resolve conflicts, but it's easiest
when done at this point)
> git format-patch -o ... HEAD^
> I do bunch of
> git am -3 (which usually has a conflict of some way or other)
> git add XXXX
> git am -3 --resolve
> git push
The less the time gap between their "git format-patch" and
your "git am", the less conflicts you will have. If you're
working almost in "real time", the next user gets the latest
tree when he does his "git rebase origin/master" -- and in
fact that becomes pretty much the only point at which any
conflicts even happen.
...and you don't usually have to resolve a single conflict
;-)
^ permalink raw reply
* Re: [PATCH] format-patch: avoid generation of empty patches
From: Alexander Potashev @ 2009-01-10 16:17 UTC (permalink / raw)
To: Nathan W. Panike; +Cc: Junio C Hamano, git
In-Reply-To: <d77df1110901100801s463bb43bt701a95df14f167d8@mail.gmail.com>
On 10:01 Sat 10 Jan , Nathan W. Panike wrote:
> Hi:
>
> On Sat, Jan 10, 2009 at 5:39 AM, Alexander Potashev
> <aspotashev@gmail.com> wrote:
> ...
> >
> > + if (!commit->parents && !rev.show_root_diff)
> > + break;
>
> Do you really want to stop getting commits? It seems like the break
> statement here should be a continue.
AFAIU get_revision stops revision iteration when it appears to stay at
the root commit. So, if we will replace 'break' with 'continue', the
'while' loop will finish right after that 'continue'.
However, I might be wrong... please, correct me then.
>
> Nathan Panike
^ permalink raw reply
* Re: [PATCH 3/6] Glean libexec path from argv[0] for git-upload-pack and git-receive-pack.
From: Steffen Prohaska @ 2009-01-10 16:01 UTC (permalink / raw)
To: Johannes Schindelin
Cc: Junio C Hamano, Git Mailing List, Johannes Sixt, Steve Haslam
In-Reply-To: <alpine.DEB.1.00.0901101532430.30769@pacific.mpi-cbg.de>
On Jan 10, 2009, at 3:34 PM, Johannes Schindelin wrote:
> Logically, and to avoid committing a broken revision, 1/6 should come
> last, methinks.
RUNTIME_PREFIX is not defined before 6/6. But I agree,
1/6 should probably be moved after 5/6.
Steffen
^ permalink raw reply
* Re: [PATCH] format-patch: avoid generation of empty patches
From: Nathan W. Panike @ 2009-01-10 16:01 UTC (permalink / raw)
To: Alexander Potashev; +Cc: Junio C Hamano, git
In-Reply-To: <20090110113903.GB25723@myhost>
Hi:
On Sat, Jan 10, 2009 at 5:39 AM, Alexander Potashev
<aspotashev@gmail.com> wrote:
...
>
> + if (!commit->parents && !rev.show_root_diff)
> + break;
Do you really want to stop getting commits? It seems like the break
statement here should be a continue.
Nathan Panike
^ permalink raw reply
* Re: [PATCH 3/6] Glean libexec path from argv[0] for git-upload-pack and git-receive-pack.
From: Steffen Prohaska @ 2009-01-10 15:55 UTC (permalink / raw)
To: Steve Haslam
Cc: Junio C Hamano, Git Mailing List, Johannes Sixt,
Johannes Schindelin
In-Reply-To: <alpine.DEB.1.00.0901101532430.30769@pacific.mpi-cbg.de>
On Jan 10, 2009, at 3:34 PM, Johannes Schindelin wrote:
> On Sat, 10 Jan 2009, Steffen Prohaska wrote:
>
>> From: Steve Haslam <shaslam@lastminute.com>
>>
>> If the user specified the full path to git-upload-pack as the -u
>> option to
>> "git clone" when cloning a remote repository, and git was not on
>> the default
>> PATH on the remote machine, git-upload-pack was failing to exec
>> git-pack-objects.
>>
>> By making the argv[0] path (if any) available to setup_path(), this
>> will
>> allow finding the "git" executable in the same directory as
>> "git-upload-pack". The default built in to exec_cmd.c is to look
>> for "git"
>> in the ".../libexec/git-core" directory, but it is not installed
>> there (any
>> longer).
>>
>> Much the same applies to invoking git-receive-pack from a non-PATH
>> location
>> using the "--exec" argument to "git push".
>>
>> [ spr: split Steve's original commit into two commits. ]
>
> I think you do not want to have that [ ... ] in the commit message,
> but
> after the "--".
>
> Further, it would make sense to have these 2 patches independently,
> provided that a test is added with which we could verify that the
> patches
> are actually necessary for upload-pack/receive-pack.
Steve,
could you comment on this. You are the original author of the patch.
Steffen
^ permalink raw reply
* [PATCH/RFC] shortlog: add option to group together different names/emails of an author
From: Adeodato Simó @ 2009-01-10 15:16 UTC (permalink / raw)
To: git; +Cc: Adeodato Simó
It's common for repositories to contain commits with different spellings of
an author name, or different email addresses. The shortlog command tries to
alleviate this by using .mailmap files. However, maintaining a .mailmap file
up to date is a manual process, and it does not help when shortlog is
invoked with the -e option and different email addresses for an author are
involved.
This commit introduces a -j/--join-uids option that uses a very dumb logic
to detect different spellings and addresses of a same author. In particular,
it just joins commits when either the name or the address had been
previously seen, attaching the commit to that previous id. In other words,
these three ids will be joined:
Author: Joe Developer <joe@example.com>
Author: Joe R. Developer <joe_r@example.com>
Author: Joe R. Developer <joe@example.com>
but only because of the third spelling. The first two alone would be left
separate. When the names and addresses are printed, the most common spelling
and address are used.
Incidentally, there is f817546 in git.git which has this author information:
Author: Wincent Colaiuta <gitster@pobox.com>
Which makes all of Wincent's commits to be assigned to Junio with -j. This
is easily fixed with an entry for gitster@pobox.com in .mailmap, which this
commit includes. (And then, only f817546 is be assigned to Junio.)
Signed-off-by: Adeodato Simó <dato@net.com.org.es>
---
This is my scratching of my own itch: I was used to `bzr author-stats`,
which is equivalent to `git shortlog -jsne`. I realize -sn comes close,
but I like having the email address listed. Please let me know what you
think.
Tests and a mention in git-shortlog.txt are missing. That'll come next
when/if I'm told this has a chance of inclusion. :-)
The code is valgrind'ed. I'm not completely confident, though, bugs will
not be hiding in corner cases. Also, I don't see any appreciable
slowdown with this version in git.git, particularly not between the
current git-shortlog and this new when run without -j (not when run with
-j either, but that's less critical).
This patch applies on top of my as/maint-shortlog-cleanup branch.
.mailmap | 1 +
builtin-shortlog.c | 280 +++++++++++++++++++++++++++++++++++++++++++++-------
shortlog.h | 14 ++-
3 files changed, 256 insertions(+), 39 deletions(-)
diff --git a/.mailmap b/.mailmap
index 373476b..f86d8a7 100644
--- a/.mailmap
+++ b/.mailmap
@@ -27,6 +27,7 @@ Joachim Berdal Haga <cjhaga@fys.uio.no>
Jon Loeliger <jdl@freescale.com>
Jon Seymour <jon@blackcubes.dyndns.org>
Jonathan Nieder <jrnieder@uchicago.edu>
+Junio C Hamano <gitster@pobox.com>
Junio C Hamano <junio@twinsun.com>
Karl Hasselström <kha@treskal.com>
Kent Engstrom <kent@lysator.liu.se>
diff --git a/builtin-shortlog.c b/builtin-shortlog.c
index 90e76ae..af155b9 100644
--- a/builtin-shortlog.c
+++ b/builtin-shortlog.c
@@ -9,24 +9,79 @@
#include "shortlog.h"
#include "parse-options.h"
+struct idinfo {
+ int count;
+ size_t idx;
+};
+
static char const * const shortlog_usage[] = {
"git shortlog [-n] [-s] [-e] [-w] [rev-opts] [--] [<commit-id>... ]",
"",
"[rev-opts] are documented in git-rev-list(1)",
NULL
};
-
-static int compare_by_number(const void *a1, const void *a2)
-{
- const struct string_list_item *i1 = a1, *i2 = a2;
- const struct string_list *l1 = i1->util, *l2 = i2->util;
+
+static int compare_by_count(const void *a1, const void *a2)
+{
+ const struct idinfo *i1 = a1, *i2 = a2;
+
+ if (i1->count < i2->count)
+ return 1;
+ else if (i1->count == i2->count)
+ return 0;
+ else
+ return -1;
+}
+
+static int compare_by_idx_and_count(const void *a1, const void *a2)
+{
+ const struct string_list_item *it1 = a1, *it2 = a2;
+ const struct idinfo *i1 = it1->util, *i2 = it2->util;
+
+ if (i1->idx < i2->idx)
+ return -1;
+ else if (i1->idx > i2->idx)
+ return 1;
+ else if (i1->count < i2->count)
+ return 1;
+ else if (i1->count > i2->count)
+ return -1;
+ else
+ return 0;
+}
+
+static int compare_by_nr(const void *a1, const void *a2)
+{
+ const struct string_list *l1 = a1, *l2 = a2;
if (l1->nr < l2->nr)
return 1;
- else if (l1->nr == l2->nr)
+ else if (l1->nr > l2->nr)
+ return -1;
+ else if (l1->nr == 0)
return 0;
else
+ return strcmp(l1->items[0].util, l2->items[0].util);
+}
+
+static int compare_by_first_util_str(const void *a1, const void *a2)
+{
+ const struct string_list *l1 = a1, *l2 = a2;
+ if (l1->nr && l2->nr)
+ return strcmp(l1->items[0].util, l2->items[0].util);
+ else if (!l1->nr && !l2->nr)
+ return 0;
+ else if (l1->nr)
return -1;
+ else
+ return 1;
+}
+
+static inline void alloc_grow_all_lines(struct shortlog *log)
+{
+ ALLOC_GROW(log->all_lines, log->nr + 1, log->alloc);
+ memset(log->all_lines + log->nr,
+ 0, (log->alloc - log->nr) * sizeof(struct string_list));
}
static void insert_one_record(struct shortlog *log,
@@ -35,9 +90,11 @@ static void insert_one_record(struct shortlog *log,
{
const char *dot3 = log->common_repo_prefix;
char *buffer, *p;
- struct string_list_item *item;
+ struct string_list_item *item, *name, *email;
char namebuf[1024];
- size_t len;
+ char emailbuf[1024];
+ struct idinfo *nu, *eu;
+ size_t len, idx;
const char *eol;
const char *boemail, *eoemail;
@@ -61,16 +118,117 @@ static void insert_one_record(struct shortlog *log,
else
len = strlen(namebuf);
- if (log->email) {
- size_t room = sizeof(namebuf) - len - 1;
- int maillen = eoemail - boemail + 1;
- snprintf(namebuf + len, room, " %.*s", maillen, boemail);
- }
-
- item = string_list_insert(namebuf, &log->list);
- if (item->util == NULL)
- item->util = xcalloc(1, sizeof(struct string_list));
-
+ /*
+ * log->all_lines is an array of string_lists where each list
+ * contains all the records by an author. The author information
+ * for all_lines[i] is in the element in log->names that has
+ * the "idx" member set to i.
+ *
+ * If join_uids is on, we try to detect different spellings and
+ * different email addresses of a same author: when saving a
+ * record, we check if we've already seen either the name or the
+ * address. If we have, we append to that author (and save the
+ * new name/address as alternative spelling). If we have seen
+ * both, but they point to different authors, we merge the
+ * entries, and always associate the result with the address.
+ *
+ * To merge in the right order, each record in all_lines[x] has
+ * an id (autocounter) in the "util" member.
+ */
+ if (!log->join_uids) {
+ if (log->email) {
+ size_t room = sizeof(namebuf) - len - 1;
+ int maillen = eoemail - boemail + 1;
+ snprintf(namebuf + len, room,
+ " %.*s", maillen, boemail);
+ }
+ name = string_list_insert(namebuf, &log->names);
+
+ if (name->util == NULL) {
+ alloc_grow_all_lines(log);
+ name->util = nu = xcalloc(1, sizeof(struct idinfo));
+ nu->idx = idx = log->nr++;
+ nu->count = 1;
+ }
+ else {
+ nu = name->util;
+ idx = nu->idx;
+ nu->count++;
+ }
+ goto write_line; /* Save one precious level of indentation. */
+ }
+
+ int maillen = eoemail - boemail - 1;
+ snprintf(emailbuf, sizeof(emailbuf), "%.*s", maillen, boemail+1);
+
+ name = string_list_insert(namebuf, &log->names);
+ email = string_list_insert(emailbuf, &log->emails);
+
+ if (name->util == NULL && email->util == NULL) {
+ alloc_grow_all_lines(log);
+ nu = xcalloc(1, sizeof(struct idinfo));
+ eu = xcalloc(1, sizeof(struct idinfo));
+ idx = nu->idx = eu->idx = log->nr++;
+ }
+ else if (name->util == NULL) {
+ nu = xcalloc(1, sizeof(struct idinfo));
+ eu = email->util;
+ idx = nu->idx = eu->idx;
+ }
+ else if (email->util == NULL) {
+ nu = name->util;
+ eu = xcalloc(1, sizeof(struct idinfo));
+ idx = eu->idx = nu->idx;
+ }
+ else {
+ nu = name->util;
+ eu = email->util;
+
+ if (nu->idx != eu->idx) {
+ /* Merge both entries. */
+ int i, j, oldidx;
+ struct idinfo *info;
+ struct string_list new = { NULL, 0, 0, 0 };
+ struct string_list *l1 = &log->all_lines[nu->idx];
+ struct string_list *l2 = &log->all_lines[eu->idx];
+
+ for (i = 0, j = 0; i < l1->nr && j < l2->nr; ) {
+ int c1 = (intptr_t) l1->items[i].util;
+ int c2 = (intptr_t) l2->items[j].util;
+ if (c1 < c2)
+ string_list_append(l1->items[i++].string, &new);
+ else
+ string_list_append(l2->items[j++].string, &new);
+ }
+ while (i < l1->nr) {
+ string_list_append(l1->items[i++].string, &new);
+ }
+ while (j < l2->nr) {
+ string_list_append(l2->items[j++].string, &new);
+ }
+
+ oldidx = nu->idx; /* Always favour the email. */
+
+ for (i = 0; i < log->names.nr; i++)
+ if ((info = log->names.items[i].util)->idx == oldidx)
+ info->idx = eu->idx;
+
+ for (i = 0; i < log->emails.nr; i++)
+ if ((info = log->emails.items[i].util)->idx == oldidx)
+ info->idx = eu->idx;
+
+ string_list_clear(l1, 0);
+ string_list_clear(l2, 0);
+ memcpy(l2, &new, sizeof(struct string_list));
+ }
+ idx = nu->idx;
+ }
+ nu->count++;
+ eu->count++;
+ name->util = nu;
+ email->util = eu;
+
+write_line:
/* Skip any leading whitespace, including any blank lines. */
while (*oneline && isspace(*oneline))
oneline++;
@@ -100,7 +258,8 @@ static void insert_one_record(struct shortlog *log,
}
}
- string_list_append(buffer, item->util);
+ item = string_list_append(buffer, &log->all_lines[idx]);
+ item->util = (void*)(intptr_t) log->commit_count++;
}
static void read_from_stdin(struct shortlog *log)
@@ -218,10 +377,12 @@ void shortlog_init(struct shortlog *log)
read_mailmap(&log->mailmap, ".mailmap", &log->common_repo_prefix);
- log->list.strdup_strings = 1;
log->wrap = DEFAULT_WRAPLEN;
log->in1 = DEFAULT_INDENT1;
log->in2 = DEFAULT_INDENT2;
+
+ log->names.strdup_strings = 1;
+ log->emails.strdup_strings = 1;
}
int cmd_shortlog(int argc, const char **argv, const char *prefix)
@@ -237,6 +398,8 @@ int cmd_shortlog(int argc, const char **argv, const char *prefix)
"Suppress commit descriptions, only provides commit count"),
OPT_BOOLEAN('e', "email", &log.email,
"Show the email address of each author"),
+ OPT_BOOLEAN('j', "join-uids", &log.join_uids,
+ "Group together different spellings and addresses of an author"),
{ OPTION_CALLBACK, 'w', NULL, &log, "w[,i1[,i2]]",
"Linewrap output", PARSE_OPT_OPTARG, &parse_wrap_args },
OPT_END(),
@@ -285,16 +448,65 @@ parse_done:
void shortlog_output(struct shortlog *log)
{
int i, j;
- if (log->sort_by_number)
- qsort(log->list.items, log->list.nr, sizeof(struct string_list_item),
- compare_by_number);
- for (i = 0; i < log->list.nr; i++) {
- struct string_list *onelines = log->list.items[i].util;
-
+
+ /*
+ * We do some pre-processing to find the author name for each item
+ * in log->all_lines, saving it in all_lines[i].util. If join_uids
+ * is on, the most common spelling and address will be used.
+ */
+ qsort(log->names.items, log->names.nr,
+ sizeof(struct string_list_item), compare_by_idx_and_count);
+
+ if (log->join_uids && log->email)
+ qsort(log->emails.items, log->emails.nr,
+ sizeof(struct string_list_item), compare_by_idx_and_count);
+
+ for (i = 0, j = 0; ; i++) {
+ static int idx = -1;
+ static const struct idinfo *info = NULL;
+ while (i < log->names.nr &&
+ (info = log->names.items[i].util)->idx == idx)
+ i++;
+ if (!info || info->idx == idx)
+ break;
+ idx = info->idx;
+ if (log->join_uids && log->email) {
+ int len;
+ char *name, *email, *newname;
+ while (j < log->emails.nr &&
+ (info = log->emails.items[j].util)->idx != idx)
+ j++;
+ if (j == log->emails.nr)
+ die("Could not find email address for '%s'",
+ log->names.items[i].string);
+ name = log->names.items[i].string;
+ email = log->emails.items[j].string;
+ len = strlen(name) + strlen(email) + 4;
+ newname = xmalloc(len);
+ snprintf(newname, len, "%s <%s>", name, email);
+ free(name);
+ log->names.items[i].string = newname;
+ }
+ log->all_lines[idx].items[0].util = log->names.items[i].string;
+ }
+
+ qsort(log->all_lines, log->nr, sizeof(struct string_list),
+ log->sort_by_number ? compare_by_nr : compare_by_first_util_str);
+
+ for (i = 0; i < log->nr; i++) {
+ const char *name;
+ struct string_list *onelines = &log->all_lines[i];
+
+ if (onelines->nr == 0)
+ /* There can be empty lists for merged names. */
+ continue;
+ else
+ name = onelines->items[0].util;
+
if (log->summary) {
- printf("%6d\t%s\n", onelines->nr, log->list.items[i].string);
+ printf("%6d\t%s\n", onelines->nr, name);
} else {
- printf("%s (%d):\n", log->list.items[i].string, onelines->nr);
+ printf("%s (%d):\n", name, onelines->nr);
for (j = onelines->nr - 1; j >= 0; j--) {
const char *msg = onelines->items[j].string;
@@ -308,15 +520,13 @@ void shortlog_output(struct shortlog *log)
}
putchar('\n');
}
-
onelines->strdup_strings = 1;
string_list_clear(onelines, 0);
- free(onelines);
- log->list.items[i].util = NULL;
- }
-
- log->list.strdup_strings = 1;
- string_list_clear(&log->list, 1);
+ }
+
+ free(log->all_lines);
+ string_list_clear(&log->names, 1);
+ string_list_clear(&log->emails, 1);
log->mailmap.strdup_strings = 1;
string_list_clear(&log->mailmap, 1);
}
diff --git a/shortlog.h b/shortlog.h
index bc02cc2..f539bf0 100644
--- a/shortlog.h
+++ b/shortlog.h
@@ -4,18 +4,24 @@
#include "string-list.h"
struct shortlog {
- struct string_list list;
int summary;
int wrap_lines;
int sort_by_number;
int wrap;
int in1;
int in2;
- int user_format;
-
+ int email;
+ int join_uids;
+
+ int user_format;
char *common_repo_prefix;
- int email;
struct string_list mailmap;
+
+ int nr, alloc;
+ int commit_count;
+ struct string_list names;
+ struct string_list emails;
+ struct string_list *all_lines;
};
void shortlog_init(struct shortlog *log);
--
1.6.1.134.g55c35
^ permalink raw reply related
* Re: What's cooking in git.git (Jan 2009, #01; Mon, 05)
From: Jonas Fonseca @ 2009-01-10 15:10 UTC (permalink / raw)
To: Junio C Hamano; +Cc: Miklos Vajna, git
In-Reply-To: <7vr63by9cw.fsf@gitster.siamese.dyndns.org>
On Sat, Jan 10, 2009 at 01:15, Junio C Hamano <gitster@pobox.com> wrote:
> "Jonas Fonseca" <jonas.fonseca@gmail.com> writes:
>
>> On Tue, Jan 6, 2009 at 01:33, Junio C Hamano <gitster@pobox.com> wrote:
>>> ----------------------------------------------------------------
>>> * mv/apply-parse-opt (Sun Dec 28 00:03:57 2008 +0100) 1 commit
>>> + parse-opt: migrate builtin-apply.
>>
>> This broke apply for me after updating to the current "next" earlier
>> today.
>
> Thanks. I think this patch would fix it.
Thank you for the quick fix.
--
Jonas Fonseca
^ permalink raw reply
* Re: Main branch being maintained with 'git am', how do mere mortals interact without too much conflicts?
From: Santi Béjar @ 2009-01-10 14:47 UTC (permalink / raw)
To: Junichi Uekawa; +Cc: git
In-Reply-To: <87vdsntnyd.dancerj%dancer@netfort.gr.jp>
2009/1/10 Junichi Uekawa <dancer@netfort.gr.jp>:
> Hi,
>
> I've been maintaining my Git repository (monthlyreport.git) where most
> people do not have push access, and I'm taking patches through e-mail
> with 'git am'.
>
> It often happens that I'm receiving patches which won't apply without
> a merge ('git am -3') and happen to be conflict-resolving often,
> because people work off a branch a few days before, and try to send
> patches nearer the deadline (This is a monthly meeting resume, which
> people are expected to submit their material, so this is kind of
> normal).
>
>
> One thing I'm worried is that users apparently have to throw away
> their own change or do some conflict resolution.
>
>
> User does
> git pull xxxx
> edit ...
> git add
> git commit
> git format-patch -o ... HEAD^
>
>
> I do bunch of
> git am -3 (which usually has a conflict of some way or other)
> git add XXXX
> git am -3 --resolve
> git push
>
>
> User then find that when doing
>
> git pull
>
> again, a conflict will occur.
>
>
>
> I am thinking of recommending the users to create a branch
>
> git checkout -b my-work-for-2009-01 origin
> edit ...
> git add
> git commit
> git format-patch -o ... HEAD^
> send the email
>
> and do
>
> git checkout master
> git pull
>
> and throw away their branches when they are included upstream.
>
>
>
> Something tells me the problem is that I'm probably using a workflow
> that resembles SVN too much, and users aren't used to branches yet.
> Has anybody found this to be a problem, or better yet, is there a
> better workflow?
I think your workflow is fine. When someone sends a patch s/he has to
know that their branch is a throw away branch to create the patch.
Another thing is if you send it as a public repository or as a bundle,
and even then the maintainer can decide to apply it merging or
cherry-picking.
There is a doc explaining " An overview of recommended workflows with
git" in git:
http://www.kernel.org/pub/software/scm/git/docs/gitworkflows.html
HTH,
Santi
^ permalink raw reply
* Re: trouble getting git cvsimport working
From: Johannes Schindelin @ 2009-01-10 14:55 UTC (permalink / raw)
To: Caleb Cushing; +Cc: git
In-Reply-To: <81bfc67a0901100635i4d33c294x393a8d2dfc2b0e0d@mail.gmail.com>
Hi,
On Sat, 10 Jan 2009, Caleb Cushing wrote:
> git cvsimport -a -v -d
> :pserver:anonymous@anoncvs.gentoo.org/var/cvsroot/ gentoo-x86 -C
> portage
> Initialized empty Git repository in /home/portdev/cvs/portage/.git/
> Running cvsps...
> parse error on third token
> WARNING: malformed CVS version str: Server: (unknown)
> WARNING: Your CVS client version:
> [Client: Concurrent Versions System (CVS) 1.12.12 (client)]
> and/or server version:
> [Server: (unknown)]
> are too old to properly support the rlog command.
> This command was introduced in 1.11.1. Cvsps
> will use log instead, but PatchSet numbering
> may become unstable due to pruned empty
> directories.
This is the problem.
> cvs log: warning: failed to open /home/portdev/.cvspass for reading:
> No such file or directory
> cvs log: in directory .:
> cvs [log aborted]: there is no version here; run 'cvs checkout' first
And this is the solution: Just try
$ cvs -d :pserver:anonymous@anoncvs.gentoo.org/var/cvsroot/ \
co gentoo-x86
$ cd gentoo-x86
$ git cvsimport -v
(I assume it is a live repository, so -a is dangerous.)
Hth,
Dscho
^ permalink raw reply
* Re: Main branch being maintained with 'git am', how do mere mortals interact without too much conflicts?
From: Peter Harris @ 2009-01-10 14:47 UTC (permalink / raw)
To: Junichi Uekawa; +Cc: git
In-Reply-To: <87vdsntnyd.dancerj%dancer@netfort.gr.jp>
On Sat, Jan 10, 2009 at 6:11 AM, Junichi Uekawa wrote:
> I am thinking of recommending the users to create a branch
...
> and throw away their branches when they are included upstream.
Yes, with a patch based workflow, this is almost required; all of the
commits will at least have different committer information.
There's nothing wrong with this approach.
> Something tells me the problem is that I'm probably using a workflow
> that resembles SVN too much, and users aren't used to branches yet.
> Has anybody found this to be a problem, or better yet, is there a
> better workflow?
If you need the commits to be identical, and you don't mind your email
consisting of a binary blob attachment, you can ask your contributors
to send you a bundle instead of a series of patches. "git help bundle"
for details.
Peter Harris
^ permalink raw reply
* Re: trouble getting git cvsimport working
From: Caleb Cushing @ 2009-01-10 14:35 UTC (permalink / raw)
To: Johannes Schindelin; +Cc: git
In-Reply-To: <alpine.DEB.1.00.0901101524310.30769@pacific.mpi-cbg.de>
> > sh: cvs: command not found
>
>
> What's this?
does git need more than cvsps to work (I assumed my package manager
had installed all needed deps)? I installed cvs after you pointed that
out...
git cvsimport -a -v -d
:pserver:anonymous@anoncvs.gentoo.org/var/cvsroot/ gentoo-x86 -C
portage
Initialized empty Git repository in /home/portdev/cvs/portage/.git/
Running cvsps...
parse error on third token
WARNING: malformed CVS version str: Server: (unknown)
WARNING: Your CVS client version:
[Client: Concurrent Versions System (CVS) 1.12.12 (client)]
and/or server version:
[Server: (unknown)]
are too old to properly support the rlog command.
This command was introduced in 1.11.1. Cvsps
will use log instead, but PatchSet numbering
may become unstable due to pruned empty
directories.
cvs log: warning: failed to open /home/portdev/.cvspass for reading:
No such file or directory
cvs log: in directory .:
cvs [log aborted]: there is no version here; run 'cvs checkout' first
DONE; creating master branch
fatal: refs/heads/origin: not a valid SHA1
fatal: master: not a valid SHA1
fatal: You are on a branch yet to be born
checkout failed: 32768
--
Caleb Cushing
http://xenoterracide.blogspot.com
^ permalink raw reply
* Re: [PATCH 3/6] Glean libexec path from argv[0] for git-upload-pack and git-receive-pack.
From: Johannes Schindelin @ 2009-01-10 14:34 UTC (permalink / raw)
To: Steffen Prohaska; +Cc: Junio C Hamano, git, Johannes Sixt, Steve Haslam
In-Reply-To: <1231595452-27698-3-git-send-email-prohaska@zib.de>
Hi,
On Sat, 10 Jan 2009, Steffen Prohaska wrote:
> From: Steve Haslam <shaslam@lastminute.com>
>
> If the user specified the full path to git-upload-pack as the -u option to
> "git clone" when cloning a remote repository, and git was not on the default
> PATH on the remote machine, git-upload-pack was failing to exec
> git-pack-objects.
>
> By making the argv[0] path (if any) available to setup_path(), this will
> allow finding the "git" executable in the same directory as
> "git-upload-pack". The default built in to exec_cmd.c is to look for "git"
> in the ".../libexec/git-core" directory, but it is not installed there (any
> longer).
>
> Much the same applies to invoking git-receive-pack from a non-PATH location
> using the "--exec" argument to "git push".
>
> [ spr: split Steve's original commit into two commits. ]
I think you do not want to have that [ ... ] in the commit message, but
after the "--".
Further, it would make sense to have these 2 patches independently,
provided that a test is added with which we could verify that the patches
are actually necessary for upload-pack/receive-pack.
Logically, and to avoid committing a broken revision, 1/6 should come
last, methinks.
Ciao,
Dscho
^ permalink raw reply
* Re: trouble getting git cvsimport working
From: Johannes Schindelin @ 2009-01-10 14:25 UTC (permalink / raw)
To: Caleb Cushing; +Cc: git
In-Reply-To: <81bfc67a0901100516w10ea77e8n8734713b071d69b9@mail.gmail.com>
Hi,
On Sat, 10 Jan 2009, Caleb Cushing wrote:
> sh: cvs: command not found
What's this?
Ciao,
Dscho
^ permalink raw reply
* Re: [PATCH v4] submodule: allow tracking of the newest revision of a branch in a submodule
From: Johannes Schindelin @ 2009-01-10 14:23 UTC (permalink / raw)
To: Fabian Franz; +Cc: git, j.sixt, hjemli, gitster
In-Reply-To: <1231553410-7541-1-git-send-email-git@fabian-franz.de>
Hi,
On Sat, 10 Jan 2009, Fabian Franz wrote:
> Submodules currently only allow tracking a specific revision and each
> update in a submodule leads to a new commit in the master repository.
> However some users may want to always track the newest revision of a
> specific (named) tag or branch or HEAD. For example the user might want
> to track a staging branch in all submodules.
I wonder how you want to deal with "git bisect". Or for that matter, with
"git checkout HEAD^500".
Ciao,
Dscho
^ permalink raw reply
* Re: [PATCH] gitweb: suggest name for OPML view
From: Jakub Narebski @ 2009-01-10 14:10 UTC (permalink / raw)
To: Giuseppe Bilotta; +Cc: git, Petr Baudis, Junio C Hamano
In-Reply-To: <1230900570-25324-1-git-send-email-giuseppe.bilotta@gmail.com>
On Fri, 2 Jan 2009, Giuseppe Bilotta wrote:
> Suggest opml.xml as name for OPML view by providing the appropriate
> header, consistently with similar usage in project_index view.
It is not name for a view, but more of default filename when saving
it. While it is good idea to have consistency, I guess that while
'project_index' view and other non-HTML views are meant to be
downloaded and saved (snapshots, patches, patchsets), OPML view
is meant to be used on-line, just like web feeds in RSS and Atom
formats which are non-HTML too but do not have Content-Disposition
header set.
But I do not use OPML. Anyone?
>
> Signed-off-by: Giuseppe Bilotta <giuseppe.bilotta@gmail.com>
> ---
> gitweb/gitweb.perl | 6 +++++-
> 1 files changed, 5 insertions(+), 1 deletions(-)
>
> diff --git a/gitweb/gitweb.perl b/gitweb/gitweb.perl
> index b164001..995bc1a 100755
> --- a/gitweb/gitweb.perl
> +++ b/gitweb/gitweb.perl
> @@ -6122,7 +6122,11 @@ sub git_atom {
> sub git_opml {
> my @list = git_get_projects_list();
>
> - print $cgi->header(-type => 'text/xml', -charset => 'utf-8');
> + print $cgi->header(
> + -type => 'text/xml',
> + -charset => 'utf-8',
> + -content_disposition => 'inline; filename="opml.xml"');
> +
> print <<XML;
> <?xml version="1.0" encoding="utf-8"?>
> <opml version="1.0">
> --
> 1.5.6.5
>
>
--
Jakub Narebski
Poland
^ permalink raw reply
* Re: [PATCH v2] make diff --color-words customizable
From: Johannes Schindelin @ 2009-01-10 14:08 UTC (permalink / raw)
To: Jakub Narebski; +Cc: git, Davide Libenzi, Thomas Rast
In-Reply-To: <200901101436.48149.jnareb@gmail.com>
Hi,
On Sat, 10 Jan 2009, Jakub Narebski wrote:
> On Sat, 10 Jan 2009, Johannes Schindelin wrote:
> > On Sat, 10 Jan 2009, Jakub Narebski wrote:
> > > Thomas Rast wrote:
> > >
> > > > --color-words works (and always worked) by splitting words onto one
> > > > line each, and using the normal line-diff machinery to get a word
> > > > diff.
> > >
> > > Cannot we generalize diff machinery / use underlying LCS diff engine
> > > instead of going through line diff?
> >
> > What do you think we're doing? libxdiff is pretty hardcoded to newlines.
> > That's why we're substituting non-word characters with newlines.
>
> Isn't Meyers algorithm used by libxdiff based on LCS, largest common
> subsequence, and doesn't it generate from the mathematical point of
> view "diff" between two sequences (two arrays) which just happen to
> be lines? It is a bit strange that libxdiff doesn't export its low
> level algorithm...
Umm.
It _is_ Myers' algorithm. It just so happens that libxdiff hardcodes
newline to be the separator.
Ciao,
Dscho
^ permalink raw reply
* [PATCH 4/6] Add calls to git_extract_argv0_path() in programs that call git_config_*
From: Steffen Prohaska @ 2009-01-10 13:50 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git, Johannes Schindelin, Johannes Sixt, Steffen Prohaska
In-Reply-To: <1231595452-27698-3-git-send-email-prohaska@zib.de>
Programs that use git_config need to find the global configuration.
When runtime prefix computation is enabled, this requires that
git_extract_argv0_path() is called early in the program's main().
This commit adds the necessary calls.
Signed-off-by: Steffen Prohaska <prohaska@zib.de>
---
daemon.c | 3 +++
fast-import.c | 4 ++++
hash-object.c | 4 ++++
http-push.c | 3 +++
imap-send.c | 4 ++++
index-pack.c | 4 ++++
merge-index.c | 4 ++++
merge-tree.c | 4 ++++
mktag.c | 4 ++++
mktree.c | 4 ++++
pack-redundant.c | 4 ++++
patch-id.c | 4 ++++
unpack-file.c | 4 ++++
update-server-info.c | 4 ++++
var.c | 4 ++++
15 files changed, 58 insertions(+), 0 deletions(-)
diff --git a/daemon.c b/daemon.c
index 540700e..1c5e604 100644
--- a/daemon.c
+++ b/daemon.c
@@ -937,6 +937,9 @@ int main(int argc, char **argv)
gid_t gid = 0;
int i;
+ if (argv[0] && *argv[0])
+ git_extract_argv0_path(argv[0]);
+
for (i = 1; i < argc; i++) {
char *arg = argv[i];
diff --git a/fast-import.c b/fast-import.c
index a6bce66..7762205 100644
--- a/fast-import.c
+++ b/fast-import.c
@@ -150,6 +150,7 @@ Format of STDIN stream:
#include "refs.h"
#include "csum-file.h"
#include "quote.h"
+#include "exec_cmd.h"
#define PACK_ID_BITS 16
#define MAX_PACK_ID ((1<<PACK_ID_BITS)-1)
@@ -2405,6 +2406,9 @@ int main(int argc, const char **argv)
{
unsigned int i, show_stats = 1;
+ if (argv[0] && *argv[0])
+ git_extract_argv0_path(argv[0]);
+
setup_git_directory();
git_config(git_pack_config, NULL);
if (!pack_compression_seen && core_compression_seen)
diff --git a/hash-object.c b/hash-object.c
index 846e91a..a689cc6 100644
--- a/hash-object.c
+++ b/hash-object.c
@@ -8,6 +8,7 @@
#include "blob.h"
#include "quote.h"
#include "parse-options.h"
+#include "exec_cmd.h"
static void hash_fd(int fd, const char *type, int write_object, const char *path)
{
@@ -81,6 +82,9 @@ int main(int argc, const char **argv)
type = blob_type;
+ if (argv[0] && *argv[0])
+ git_extract_argv0_path(argv[0]);
+
git_config(git_default_config, NULL);
argc = parse_options(argc, argv, hash_object_options, hash_object_usage, 0);
diff --git a/http-push.c b/http-push.c
index a4b7d08..dd2b2b1 100644
--- a/http-push.c
+++ b/http-push.c
@@ -2179,6 +2179,9 @@ int main(int argc, char **argv)
struct ref *ref;
char *rewritten_url = NULL;
+ if (argv[0] && *argv[0])
+ git_extract_argv0_path(argv[0]);
+
setup_git_directory();
remote = xcalloc(sizeof(*remote), 1);
diff --git a/imap-send.c b/imap-send.c
index c3fa0df..6e92aee 100644
--- a/imap-send.c
+++ b/imap-send.c
@@ -23,6 +23,7 @@
*/
#include "cache.h"
+#include "exec_cmd.h"
#ifdef NO_OPENSSL
typedef void *SSL;
#endif
@@ -1389,6 +1390,9 @@ int main(int argc, char **argv)
int total, n = 0;
int nongit_ok;
+ if (argv[0] && *argv[0])
+ git_extract_argv0_path(argv[0]);
+
/* init the random number generator */
arc4_init();
diff --git a/index-pack.c b/index-pack.c
index 2931511..0df297b 100644
--- a/index-pack.c
+++ b/index-pack.c
@@ -8,6 +8,7 @@
#include "tree.h"
#include "progress.h"
#include "fsck.h"
+#include "exec_cmd.h"
static const char index_pack_usage[] =
"git index-pack [-v] [-o <index-file>] [{ ---keep | --keep=<msg> }] [--strict] { <pack-file> | --stdin [--fix-thin] [<pack-file>] }";
@@ -880,6 +881,9 @@ int main(int argc, char **argv)
struct pack_idx_entry **idx_objects;
unsigned char pack_sha1[20];
+ if (argv[0] && *argv[0])
+ git_extract_argv0_path(argv[0]);
+
/*
* We wish to read the repository's config file if any, and
* for that it is necessary to call setup_git_directory_gently().
diff --git a/merge-index.c b/merge-index.c
index 7827e87..5d89ead 100644
--- a/merge-index.c
+++ b/merge-index.c
@@ -1,5 +1,6 @@
#include "cache.h"
#include "run-command.h"
+#include "exec_cmd.h"
static const char *pgm;
static const char *arguments[9];
@@ -93,6 +94,9 @@ int main(int argc, char **argv)
if (argc < 3)
usage("git-merge-index [-o] [-q] <merge-program> (-a | [--] <filename>*)");
+ if (argv[0] && *argv[0])
+ git_extract_argv0_path(argv[0]);
+
setup_git_directory();
read_cache();
diff --git a/merge-tree.c b/merge-tree.c
index 2d1413e..165ccfc 100644
--- a/merge-tree.c
+++ b/merge-tree.c
@@ -2,6 +2,7 @@
#include "tree-walk.h"
#include "xdiff-interface.h"
#include "blob.h"
+#include "exec_cmd.h"
static const char merge_tree_usage[] = "git-merge-tree <base-tree> <branch1> <branch2>";
static int resolve_directories = 1;
@@ -344,6 +345,9 @@ int main(int argc, char **argv)
if (argc != 4)
usage(merge_tree_usage);
+ if (argv[0] && *argv[0])
+ git_extract_argv0_path(argv[0]);
+
setup_git_directory();
buf1 = get_tree_descriptor(t+0, argv[1]);
diff --git a/mktag.c b/mktag.c
index ba3d495..ff32f8a 100644
--- a/mktag.c
+++ b/mktag.c
@@ -1,5 +1,6 @@
#include "cache.h"
#include "tag.h"
+#include "exec_cmd.h"
/*
* A signature file has a very simple fixed format: four lines
@@ -159,6 +160,9 @@ int main(int argc, char **argv)
if (argc != 1)
usage("git-mktag < signaturefile");
+ if (argv[0] && *argv[0])
+ git_extract_argv0_path(argv[0]);
+
setup_git_directory();
if (strbuf_read(&buf, 0, 4096) < 0) {
diff --git a/mktree.c b/mktree.c
index 514fd9b..8ac0d57 100644
--- a/mktree.c
+++ b/mktree.c
@@ -6,6 +6,7 @@
#include "cache.h"
#include "quote.h"
#include "tree.h"
+#include "exec_cmd.h"
static struct treeent {
unsigned mode;
@@ -70,6 +71,9 @@ int main(int ac, char **av)
unsigned char sha1[20];
int line_termination = '\n';
+ if (av[0] && *av[0])
+ git_extract_argv0_path(av[0]);
+
setup_git_directory();
while ((1 < ac) && av[1][0] == '-') {
diff --git a/pack-redundant.c b/pack-redundant.c
index e93eb96..8ff119b 100644
--- a/pack-redundant.c
+++ b/pack-redundant.c
@@ -7,6 +7,7 @@
*/
#include "cache.h"
+#include "exec_cmd.h"
#define BLKSIZE 512
@@ -601,6 +602,9 @@ int main(int argc, char **argv)
unsigned char *sha1;
char buf[42]; /* 40 byte sha1 + \n + \0 */
+ if (argv[0] && *argv[0])
+ git_extract_argv0_path(argv[0]);
+
setup_git_directory();
for (i = 1; i < argc; i++) {
diff --git a/patch-id.c b/patch-id.c
index 871f1d2..ff460e2 100644
--- a/patch-id.c
+++ b/patch-id.c
@@ -1,4 +1,5 @@
#include "cache.h"
+#include "exec_cmd.h"
static void flush_current_id(int patchlen, unsigned char *id, git_SHA_CTX *c)
{
@@ -79,6 +80,9 @@ int main(int argc, char **argv)
if (argc != 1)
usage(patch_id_usage);
+ if (argv[0] && *argv[0])
+ git_extract_argv0_path(argv[0]);
+
generate_id_list();
return 0;
}
diff --git a/unpack-file.c b/unpack-file.c
index bcdc8bb..f8bfda7 100644
--- a/unpack-file.c
+++ b/unpack-file.c
@@ -1,5 +1,6 @@
#include "cache.h"
#include "blob.h"
+#include "exec_cmd.h"
static char *create_temp_file(unsigned char *sha1)
{
@@ -25,6 +26,9 @@ int main(int argc, char **argv)
{
unsigned char sha1[20];
+ if (argv[0] && *argv[0])
+ git_extract_argv0_path(argv[0]);
+
if (argc != 2)
usage("git-unpack-file <sha1>");
if (get_sha1(argv[1], sha1))
diff --git a/update-server-info.c b/update-server-info.c
index 7e8209e..286a4dd 100644
--- a/update-server-info.c
+++ b/update-server-info.c
@@ -1,4 +1,5 @@
#include "cache.h"
+#include "exec_cmd.h"
static const char update_server_info_usage[] =
"git update-server-info [--force]";
@@ -19,6 +20,9 @@ int main(int ac, char **av)
if (i != ac)
usage(update_server_info_usage);
+ if (av[0] && *av[0])
+ git_extract_argv0_path(av[0]);
+
setup_git_directory();
return !!update_server_info(force);
diff --git a/var.c b/var.c
index f1eb314..33457dc 100644
--- a/var.c
+++ b/var.c
@@ -4,6 +4,7 @@
* Copyright (C) Eric Biederman, 2005
*/
#include "cache.h"
+#include "exec_cmd.h"
static const char var_usage[] = "git var [-l | <variable>]";
@@ -56,6 +57,9 @@ int main(int argc, char **argv)
usage(var_usage);
}
+ if (argv[0] && *argv[0])
+ git_extract_argv0_path(argv[0]);
+
setup_git_directory_gently(&nongit);
val = NULL;
--
1.6.1.85.g32c5d
^ permalink raw reply related
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox