After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 615661 - git under cygwin path normalization
git under cygwin path normalization
Status: RESOLVED FIXED
Product: meld
Classification: Other
Component: version
git master
Other Windows
: Normal normal
: ---
Assigned To: Stephen Kennedy
Stephen Kennedy
Depends on:
Blocks:
 
 
Reported: 2010-04-13 14:56 UTC by Robert Wahler
Modified: 2013-03-31 04:27 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
patch for git under cygwin path normalization (2.43 KB, patch)
2010-04-13 14:56 UTC, Robert Wahler
needs-work Details | Review

Description Robert Wahler 2010-04-13 14:56:48 UTC
Created attachment 158609 [details] [review]
patch for git under cygwin path normalization

Git expects paths to be unix forward slash even on Windows. Maintain
the paths os specific until the stage where they are handed back to git.

Example:  

git status returns "modified: meld/vcview.py" but needs to be "modified: meld\vcview.py"
Comment 1 Kai Willadsen 2010-04-13 22:20:32 UTC
What's the actual impact of this on Meld? I'm looking for a concrete example of the problem for testing.
Comment 2 Robert Wahler 2010-04-15 12:08:46 UTC
Here is an example:

mkdir test_repo
cd test_repo

echo "file content" > file1.txt
mkdir folder1
echo "file content" > folder1/file2.txt

git init
git add .
git commit -m "initial commit"

echo "new file content" > file1.txt
echo "new file content" > folder1/file2.txt

git status

# On branch master
# Changed but not updated:
#   (use "git add <file>..." to update what will be committed)
#
#       modified:   file1.txt
#       modified:   folder1/file2.txt
#

meld .

Meld will show that file1.txt is modified but will not show folder/file2.txt because meld can't find file2.txt due to the path.

You will also need the patches that I supplied on bugs 590760 and 578985 to get the vc code working on Windows.

I can supply my complete patched code if that would be helpful.  Thanks for your  time.

-robert wahler
Comment 3 Kai Willadsen 2010-06-29 22:45:55 UTC
Review of attachment 158609 [details] [review]:

::: meld/vc/git.py
@@ +70,3 @@
         return self.root
+    def normalize_path(self, path):
+        return re.sub(r"\\", "/", path)

Can't this just be path.replace("\\", "/"), avoiding importing re.

Also, I think we want an OS-based guard here. This would incorrectly munge valid paths on non-Windows systems.

@@ +85,3 @@
         for entry in entries:
             statekey, name = entry.split("\t", 2)
+            path = os.path.join(self.root, os.path.normpath(name.strip()))

It's not immediately obvious to me why normpath is required. Could you explain?

::: meld/vcview.py
@@ +406,3 @@
         else:
             workdir = self.vc.get_working_directory( _commonprefix(files) )
+        files = [ self.vc.normalize_path(relpath(workdir, f)) for f in files ]

I know this mimics the original line, but I'd appreciate it if you could fix spacing, etc. as you go (i.e., remove the spaces inside the list comprehension brackets).
Comment 4 Kai Willadsen 2013-03-31 04:27:06 UTC
This problem is fixed in current git. I fixed it in the new infrastructure rather than having to deal with the older patching style, but it works for me using msysgit.

Thanks for your bug report.