Browse Source

ArchiveCommand: Do not warn for unsupported file mode

When ArchiveCommand is invoked directly on the command line, these
warnings to stderr

	warning: mode of path/to/some/submodule ignored

are a useful hint, but in the more usual case where an archive is
being served by a server, the intended audience for that message
cannot see stderr.

Later it might be useful to accept a callback to return these warnings
out of band.

Change-Id: I22e79be69859176d85594031d67c6cb3371c4bd2
stable-3.0
Jonathan Nieder 12 years ago
parent
commit
be047307fc
  1. 1
      org.eclipse.jgit.pgm/resources/org/eclipse/jgit/pgm/CLIText.properties
  2. 1
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/CLIText.java
  3. 18
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/archive/ArchiveCommand.java

1
org.eclipse.jgit.pgm/resources/org/eclipse/jgit/pgm/CLIText.properties

@ -7,7 +7,6 @@ N=N
alreadyOnBranch=Already on ''{0}''
alreadyUpToDate=Already up-to-date.
archiveEntryModeIgnored=warning: mode of {0} ignored
authorInfo=Author: {0} <{1}>
averageMSPerRead=average {0} ms/read
branchAlreadyExists=A branch named ''{0}'' already exists.

1
org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/CLIText.java

@ -76,7 +76,6 @@ public class CLIText extends TranslationBundle {
// @formatter:off
/***/ public String alreadyOnBranch;
/***/ public String alreadyUpToDate;
/***/ public String archiveEntryModeIgnored;
/***/ public String authorInfo;
/***/ public String averageMSPerRead;
/***/ public String branchAlreadyExists;

18
org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/archive/ArchiveCommand.java

@ -43,7 +43,6 @@
package org.eclipse.jgit.pgm.archive;
import java.lang.String;
import java.lang.System;
import java.io.IOException;
import java.io.OutputStream;
import java.util.EnumMap;
@ -118,12 +117,6 @@ public class ArchiveCommand extends GitCommand<OutputStream> {
throws IOException;
}
private static void warnArchiveEntryModeIgnored(String name) {
System.err.println(MessageFormat.format( //
CLIText.get().archiveEntryModeIgnored, //
name));
}
private static final Map<Format, Archiver> formats;
static {
@ -144,7 +137,8 @@ public class ArchiveCommand extends GitCommand<OutputStream> {
|| mode == FileMode.SYMLINK) {
entry.setUnixMode(mode.getBits());
} else {
warnArchiveEntryModeIgnored(path);
// TODO(jrn): Let the caller know the tree contained
// an entry with unsupported mode (e.g., a submodule).
}
entry.setSize(loader.getSize());
out.putArchiveEntry(entry);
@ -172,10 +166,12 @@ public class ArchiveCommand extends GitCommand<OutputStream> {
final TarArchiveEntry entry = new TarArchiveEntry(path);
if (mode == FileMode.REGULAR_FILE ||
mode == FileMode.EXECUTABLE_FILE)
mode == FileMode.EXECUTABLE_FILE) {
entry.setMode(mode.getBits());
else
warnArchiveEntryModeIgnored(path);
} else {
// TODO(jrn): Let the caller know the tree contained
// an entry with unsupported mode (e.g., a submodule).
}
entry.setSize(loader.getSize());
out.putArchiveEntry(entry);
loader.copyTo(out);

Loading…
Cancel
Save