View Javadoc
1   /*
2    * Copyright (C) 2008, Google Inc.
3    * Copyright (C) 2008, Robin Rosenberg <robin.rosenberg@dewire.com>
4    * Copyright (C) 2006-2017, Shawn O. Pearce <spearce@spearce.org> and others
5    *
6    * This program and the accompanying materials are made available under the
7    * terms of the Eclipse Distribution License v. 1.0 which is available at
8    * https://www.eclipse.org/org/documents/edl-v10.php.
9    *
10   * SPDX-License-Identifier: BSD-3-Clause
11   */
12  
13  package org.eclipse.jgit.lib;
14  
15  import static java.nio.charset.StandardCharsets.UTF_8;
16  
17  import java.nio.ByteBuffer;
18  import java.nio.charset.Charset;
19  import java.security.MessageDigest;
20  import java.security.NoSuchAlgorithmException;
21  import java.text.MessageFormat;
22  
23  import org.eclipse.jgit.errors.CorruptObjectException;
24  import org.eclipse.jgit.internal.JGitText;
25  import org.eclipse.jgit.util.MutableInteger;
26  
27  /**
28   * Misc. constants and helpers used throughout JGit.
29   */
30  @SuppressWarnings("nls")
31  public final class Constants {
32  	/** Hash function used natively by Git for all objects. */
33  	private static final String HASH_FUNCTION = "SHA-1";
34  
35  	/**
36  	 * A Git object hash is 160 bits, i.e. 20 bytes.
37  	 * <p>
38  	 * Changing this assumption is not going to be as easy as changing this
39  	 * declaration.
40  	 */
41  	public static final int OBJECT_ID_LENGTH = 20;
42  
43  	/**
44  	 * A Git object can be expressed as a 40 character string of hexadecimal
45  	 * digits.
46  	 *
47  	 * @see #OBJECT_ID_LENGTH
48  	 */
49  	public static final int OBJECT_ID_STRING_LENGTH = OBJECT_ID_LENGTH * 2;
50  
51  	/** Special name for the "HEAD" symbolic-ref. */
52  	public static final String HEAD = "HEAD";
53  
54  	/** Special name for the "FETCH_HEAD" symbolic-ref. */
55  	public static final String FETCH_HEAD = "FETCH_HEAD";
56  
57  	/**
58  	 * Text string that identifies an object as a commit.
59  	 * <p>
60  	 * Commits connect trees into a string of project histories, where each
61  	 * commit is an assertion that the best way to continue is to use this other
62  	 * tree (set of files).
63  	 */
64  	public static final String TYPE_COMMIT = "commit";
65  
66  	/**
67  	 * Text string that identifies an object as a blob.
68  	 * <p>
69  	 * Blobs store whole file revisions. They are used for any user file, as
70  	 * well as for symlinks. Blobs form the bulk of any project's storage space.
71  	 */
72  	public static final String TYPE_BLOB = "blob";
73  
74  	/**
75  	 * Text string that identifies an object as a tree.
76  	 * <p>
77  	 * Trees attach object ids (hashes) to names and file modes. The normal use
78  	 * for a tree is to store a version of a directory and its contents.
79  	 */
80  	public static final String TYPE_TREE = "tree";
81  
82  	/**
83  	 * Text string that identifies an object as an annotated tag.
84  	 * <p>
85  	 * Annotated tags store a pointer to any other object, and an additional
86  	 * message. It is most commonly used to record a stable release of the
87  	 * project.
88  	 */
89  	public static final String TYPE_TAG = "tag";
90  
91  	private static final byte[] ENCODED_TYPE_COMMIT = encodeASCII(TYPE_COMMIT);
92  
93  	private static final byte[] ENCODED_TYPE_BLOB = encodeASCII(TYPE_BLOB);
94  
95  	private static final byte[] ENCODED_TYPE_TREE = encodeASCII(TYPE_TREE);
96  
97  	private static final byte[] ENCODED_TYPE_TAG = encodeASCII(TYPE_TAG);
98  
99  	/** An unknown or invalid object type code. */
100 	public static final int OBJ_BAD = -1;
101 
102 	/**
103 	 * In-pack object type: extended types.
104 	 * <p>
105 	 * This header code is reserved for future expansion. It is currently
106 	 * undefined/unsupported.
107 	 */
108 	public static final int OBJ_EXT = 0;
109 
110 	/**
111 	 * In-pack object type: commit.
112 	 * <p>
113 	 * Indicates the associated object is a commit.
114 	 * <p>
115 	 * <b>This constant is fixed and is defined by the Git packfile format.</b>
116 	 *
117 	 * @see #TYPE_COMMIT
118 	 */
119 	public static final int OBJ_COMMIT = 1;
120 
121 	/**
122 	 * In-pack object type: tree.
123 	 * <p>
124 	 * Indicates the associated object is a tree.
125 	 * <p>
126 	 * <b>This constant is fixed and is defined by the Git packfile format.</b>
127 	 *
128 	 * @see #TYPE_BLOB
129 	 */
130 	public static final int OBJ_TREE = 2;
131 
132 	/**
133 	 * In-pack object type: blob.
134 	 * <p>
135 	 * Indicates the associated object is a blob.
136 	 * <p>
137 	 * <b>This constant is fixed and is defined by the Git packfile format.</b>
138 	 *
139 	 * @see #TYPE_BLOB
140 	 */
141 	public static final int OBJ_BLOB = 3;
142 
143 	/**
144 	 * In-pack object type: annotated tag.
145 	 * <p>
146 	 * Indicates the associated object is an annotated tag.
147 	 * <p>
148 	 * <b>This constant is fixed and is defined by the Git packfile format.</b>
149 	 *
150 	 * @see #TYPE_TAG
151 	 */
152 	public static final int OBJ_TAG = 4;
153 
154 	/** In-pack object type: reserved for future use. */
155 	public static final int OBJ_TYPE_5 = 5;
156 
157 	/**
158 	 * In-pack object type: offset delta
159 	 * <p>
160 	 * Objects stored with this type actually have a different type which must
161 	 * be obtained from their delta base object. Delta objects store only the
162 	 * changes needed to apply to the base object in order to recover the
163 	 * original object.
164 	 * <p>
165 	 * An offset delta uses a negative offset from the start of this object to
166 	 * refer to its delta base. The base object must exist in this packfile
167 	 * (even in the case of a thin pack).
168 	 * <p>
169 	 * <b>This constant is fixed and is defined by the Git packfile format.</b>
170 	 */
171 	public static final int OBJ_OFS_DELTA = 6;
172 
173 	/**
174 	 * In-pack object type: reference delta
175 	 * <p>
176 	 * Objects stored with this type actually have a different type which must
177 	 * be obtained from their delta base object. Delta objects store only the
178 	 * changes needed to apply to the base object in order to recover the
179 	 * original object.
180 	 * <p>
181 	 * A reference delta uses a full object id (hash) to reference the delta
182 	 * base. The base object is allowed to be omitted from the packfile, but
183 	 * only in the case of a thin pack being transferred over the network.
184 	 * <p>
185 	 * <b>This constant is fixed and is defined by the Git packfile format.</b>
186 	 */
187 	public static final int OBJ_REF_DELTA = 7;
188 
189 	/**
190 	 * Pack file signature that occurs at file header - identifies file as Git
191 	 * packfile formatted.
192 	 * <p>
193 	 * <b>This constant is fixed and is defined by the Git packfile format.</b>
194 	 */
195 	public static final byte[] PACK_SIGNATURE = { 'P', 'A', 'C', 'K' };
196 
197 	/**
198 	 * Native character encoding for commit messages, file names...
199 	 *
200 	 * @deprecated Use {@link java.nio.charset.StandardCharsets#UTF_8} directly
201 	 *             instead.
202 	 */
203 	@Deprecated
204 	public static final Charset CHARSET;
205 
206 	/**
207 	 * Native character encoding for commit messages, file names...
208 	 *
209 	 * @deprecated Use {@link java.nio.charset.StandardCharsets#UTF_8} directly
210 	 *             instead.
211 	 */
212 	@Deprecated
213 	public static final String CHARACTER_ENCODING;
214 
215 	/** Default main branch name */
216 	public static final String MASTER = "master";
217 
218 	/** Default stash branch name */
219 	public static final String STASH = "stash";
220 
221 	/** Prefix for branch refs */
222 	public static final String R_HEADS = "refs/heads/";
223 
224 	/** Prefix for remotes refs */
225 	public static final String R_REMOTES = "refs/remotes/";
226 
227 	/** Prefix for tag refs */
228 	public static final String R_TAGS = "refs/tags/";
229 
230 	/** Prefix for notes refs */
231 	public static final String R_NOTES = "refs/notes/";
232 
233 	/** Standard notes ref */
234 	public static final String R_NOTES_COMMITS = R_NOTES + "commits";
235 
236 	/** Prefix for any ref */
237 	public static final String R_REFS = "refs/";
238 
239 	/** Standard stash ref */
240 	public static final String R_STASH = R_REFS + STASH;
241 
242 	/** Logs folder name */
243 	public static final String LOGS = "logs";
244 
245 	/**
246 	 * Objects folder name
247 	 * @since 5.5
248 	 */
249 	public static final String OBJECTS = "objects";
250 
251 	/**
252 	 * Reftable folder name
253 	 * @since 5.6
254 	 */
255 	public static final String REFTABLE = "reftable";
256 
257 	/**
258 	 * Reftable table list name.
259 	 * @since 5.6.2
260 	 */
261 	public static final String TABLES_LIST = "tables.list";
262 
263 	/** Info refs folder */
264 	public static final String INFO_REFS = "info/refs";
265 
266 	/**
267 	 * Info alternates file (goes under OBJECTS)
268 	 * @since 5.5
269 	 */
270 	public static final String INFO_ALTERNATES = "info/alternates";
271 
272 	/**
273 	 * HTTP alternates file (goes under OBJECTS)
274 	 * @since 5.5
275 	 */
276 	public static final String INFO_HTTP_ALTERNATES = "info/http-alternates";
277 
278 	/** Packed refs file */
279 	public static final String PACKED_REFS = "packed-refs";
280 
281 	/**
282 	 * Excludes-file
283 	 *
284 	 * @since 3.0
285 	 */
286 	public static final String INFO_EXCLUDE = "info/exclude";
287 
288 	/**
289 	 * Attributes-override-file
290 	 *
291 	 * @since 4.2
292 	 */
293 	public static final String INFO_ATTRIBUTES = "info/attributes";
294 
295 	/**
296 	 * The system property that contains the system user name
297 	 *
298 	 * @since 3.6
299 	 */
300 	public static final String OS_USER_DIR = "user.dir";
301 
302 	/** The system property that contains the system user name */
303 	public static final String OS_USER_NAME_KEY = "user.name";
304 
305 	/** The environment variable that contains the author's name */
306 	public static final String GIT_AUTHOR_NAME_KEY = "GIT_AUTHOR_NAME";
307 
308 	/** The environment variable that contains the author's email */
309 	public static final String GIT_AUTHOR_EMAIL_KEY = "GIT_AUTHOR_EMAIL";
310 
311 	/** The environment variable that contains the commiter's name */
312 	public static final String GIT_COMMITTER_NAME_KEY = "GIT_COMMITTER_NAME";
313 
314 	/** The environment variable that contains the commiter's email */
315 	public static final String GIT_COMMITTER_EMAIL_KEY = "GIT_COMMITTER_EMAIL";
316 
317 	/**
318 	 * The environment variable that blocks use of the system config file
319 	 *
320 	 * @since 3.3
321 	 */
322 	public static final String GIT_CONFIG_NOSYSTEM_KEY = "GIT_CONFIG_NOSYSTEM";
323 
324 	/**
325 	 * The key of the XDG_CONFIG_HOME directory defined in the XDG base
326 	 * directory specification, see
327 	 * {@link "https://wiki.archlinux.org/index.php/XDG_Base_Directory"}
328 	 *
329 	 * @since 5.5.2
330 	 */
331 	public static final String XDG_CONFIG_HOME = "XDG_CONFIG_HOME";
332 
333 	/**
334 	 * The environment variable that limits how close to the root of the file
335 	 * systems JGit will traverse when looking for a repository root.
336 	 */
337 	public static final String GIT_CEILING_DIRECTORIES_KEY = "GIT_CEILING_DIRECTORIES";
338 
339 	/**
340 	 * The environment variable that tells us which directory is the ".git"
341 	 * directory
342 	 */
343 	public static final String GIT_DIR_KEY = "GIT_DIR";
344 
345 	/**
346 	 * The environment variable that tells us which directory is the working
347 	 * directory.
348 	 */
349 	public static final String GIT_WORK_TREE_KEY = "GIT_WORK_TREE";
350 
351 	/**
352 	 * The environment variable that tells us which file holds the Git index.
353 	 */
354 	public static final String GIT_INDEX_FILE_KEY = "GIT_INDEX_FILE";
355 
356 	/**
357 	 * The environment variable that tells us where objects are stored
358 	 */
359 	public static final String GIT_OBJECT_DIRECTORY_KEY = "GIT_OBJECT_DIRECTORY";
360 
361 	/**
362 	 * The environment variable that tells us where to look for objects, besides
363 	 * the default objects directory.
364 	 */
365 	public static final String GIT_ALTERNATE_OBJECT_DIRECTORIES_KEY = "GIT_ALTERNATE_OBJECT_DIRECTORIES";
366 
367 	/** Default value for the user name if no other information is available */
368 	public static final String UNKNOWN_USER_DEFAULT = "unknown-user";
369 
370 	/** Beginning of the common "Signed-off-by: " commit message line */
371 	public static final String SIGNED_OFF_BY_TAG = "Signed-off-by: ";
372 
373 	/** A gitignore file name */
374 	public static final String GITIGNORE_FILENAME = ".gitignore";
375 
376 	/** Default remote name used by clone, push and fetch operations */
377 	public static final String DEFAULT_REMOTE_NAME = "origin";
378 
379 	/** Default name for the Git repository directory */
380 	public static final String DOT_GIT = ".git";
381 
382 	/** Default name for the Git repository configuration */
383 	public static final String CONFIG = "config";
384 
385 	/** A bare repository typically ends with this string */
386 	public static final String DOT_GIT_EXT = ".git";
387 
388 	/**
389 	 * The default extension for local bundle files
390 	 *
391 	 * @since 5.8
392 	 */
393 	public static final String DOT_BUNDLE_EXT = ".bundle";
394 
395 	/**
396 	 * Name of the attributes file
397 	 *
398 	 * @since 3.7
399 	 */
400 	public static final String DOT_GIT_ATTRIBUTES = ".gitattributes";
401 
402 	/**
403 	 * Key for filters in .gitattributes
404 	 *
405 	 * @since 4.2
406 	 */
407 	public static final String ATTR_FILTER = "filter";
408 
409 	/**
410 	 * clean command name, used to call filter driver
411 	 *
412 	 * @since 4.2
413 	 */
414 	public static final String ATTR_FILTER_TYPE_CLEAN = "clean";
415 
416 	/**
417 	 * smudge command name, used to call filter driver
418 	 *
419 	 * @since 4.2
420 	 */
421 	public static final String ATTR_FILTER_TYPE_SMUDGE = "smudge";
422 
423 	/**
424 	 * Builtin filter commands start with this prefix
425 	 *
426 	 * @since 4.6
427 	 */
428 	public static final String BUILTIN_FILTER_PREFIX = "jgit://builtin/";
429 
430 	/** Name of the ignore file */
431 	public static final String DOT_GIT_IGNORE = ".gitignore";
432 
433 	/** Name of the submodules file */
434 	public static final String DOT_GIT_MODULES = ".gitmodules";
435 
436 	/** Name of the .git/shallow file */
437 	public static final String SHALLOW = "shallow";
438 
439 	/**
440 	 * Prefix of the first line in a ".git" file
441 	 *
442 	 * @since 3.6
443 	 */
444 	public static final String GITDIR = "gitdir: ";
445 
446 	/**
447 	 * Name of the folder (inside gitDir) where submodules are stored
448 	 *
449 	 * @since 3.6
450 	 */
451 	public static final String MODULES = "modules";
452 
453 	/**
454 	 * Name of the folder (inside gitDir) where the hooks are stored.
455 	 *
456 	 * @since 3.7
457 	 */
458 	public static final String HOOKS = "hooks";
459 
460 	/**
461 	 * Merge attribute.
462 	 *
463 	 * @since 4.9
464 	 */
465 	public static final String ATTR_MERGE = "merge"; //$NON-NLS-1$
466 
467 	/**
468 	 * Diff attribute.
469 	 *
470 	 * @since 4.11
471 	 */
472 	public static final String ATTR_DIFF = "diff"; //$NON-NLS-1$
473 
474 	/**
475 	 * Binary value for custom merger.
476 	 *
477 	 * @since 4.9
478 	 */
479 	public static final String ATTR_BUILTIN_BINARY_MERGER = "binary"; //$NON-NLS-1$
480 
481 	/**
482 	 * Create a new digest function for objects.
483 	 *
484 	 * @return a new digest object.
485 	 * @throws java.lang.RuntimeException
486 	 *             this Java virtual machine does not support the required hash
487 	 *             function. Very unlikely given that JGit uses a hash function
488 	 *             that is in the Java reference specification.
489 	 */
490 	public static MessageDigest newMessageDigest() {
491 		try {
492 			return MessageDigest.getInstance(HASH_FUNCTION);
493 		} catch (NoSuchAlgorithmException nsae) {
494 			throw new RuntimeException(MessageFormat.format(
495 					JGitText.get().requiredHashFunctionNotAvailable, HASH_FUNCTION), nsae);
496 		}
497 	}
498 
499 	/**
500 	 * Convert an OBJ_* type constant to a TYPE_* type constant.
501 	 *
502 	 * @param typeCode the type code, from a pack representation.
503 	 * @return the canonical string name of this type.
504 	 */
505 	public static String typeString(int typeCode) {
506 		switch (typeCode) {
507 		case OBJ_COMMIT:
508 			return TYPE_COMMIT;
509 		case OBJ_TREE:
510 			return TYPE_TREE;
511 		case OBJ_BLOB:
512 			return TYPE_BLOB;
513 		case OBJ_TAG:
514 			return TYPE_TAG;
515 		default:
516 			throw new IllegalArgumentException(MessageFormat.format(
517 					JGitText.get().badObjectType, Integer.valueOf(typeCode)));
518 		}
519 	}
520 
521 	/**
522 	 * Convert an OBJ_* type constant to an ASCII encoded string constant.
523 	 * <p>
524 	 * The ASCII encoded string is often the canonical representation of
525 	 * the type within a loose object header, or within a tag header.
526 	 *
527 	 * @param typeCode the type code, from a pack representation.
528 	 * @return the canonical ASCII encoded name of this type.
529 	 */
530 	public static byte[] encodedTypeString(int typeCode) {
531 		switch (typeCode) {
532 		case OBJ_COMMIT:
533 			return ENCODED_TYPE_COMMIT;
534 		case OBJ_TREE:
535 			return ENCODED_TYPE_TREE;
536 		case OBJ_BLOB:
537 			return ENCODED_TYPE_BLOB;
538 		case OBJ_TAG:
539 			return ENCODED_TYPE_TAG;
540 		default:
541 			throw new IllegalArgumentException(MessageFormat.format(
542 					JGitText.get().badObjectType, Integer.valueOf(typeCode)));
543 		}
544 	}
545 
546 	/**
547 	 * Parse an encoded type string into a type constant.
548 	 *
549 	 * @param id
550 	 *            object id this type string came from; may be null if that is
551 	 *            not known at the time the parse is occurring.
552 	 * @param typeString
553 	 *            string version of the type code.
554 	 * @param endMark
555 	 *            character immediately following the type string. Usually ' '
556 	 *            (space) or '\n' (line feed).
557 	 * @param offset
558 	 *            position within <code>typeString</code> where the parse
559 	 *            should start. Updated with the new position (just past
560 	 *            <code>endMark</code> when the parse is successful.
561 	 * @return a type code constant (one of {@link #OBJ_BLOB},
562 	 *         {@link #OBJ_COMMIT}, {@link #OBJ_TAG}, {@link #OBJ_TREE}.
563 	 * @throws org.eclipse.jgit.errors.CorruptObjectException
564 	 *             there is no valid type identified by <code>typeString</code>.
565 	 */
566 	public static int decodeTypeString(final AnyObjectId id,
567 			final byte[] typeString, final byte endMark,
568 			final MutableInteger offset) throws CorruptObjectException {
569 		try {
570 			int position = offset.value;
571 			switch (typeString[position]) {
572 			case 'b':
573 				if (typeString[position + 1] != 'l'
574 						|| typeString[position + 2] != 'o'
575 						|| typeString[position + 3] != 'b'
576 						|| typeString[position + 4] != endMark)
577 					throw new CorruptObjectException(id, JGitText.get().corruptObjectInvalidType);
578 				offset.value = position + 5;
579 				return Constants.OBJ_BLOB;
580 
581 			case 'c':
582 				if (typeString[position + 1] != 'o'
583 						|| typeString[position + 2] != 'm'
584 						|| typeString[position + 3] != 'm'
585 						|| typeString[position + 4] != 'i'
586 						|| typeString[position + 5] != 't'
587 						|| typeString[position + 6] != endMark)
588 					throw new CorruptObjectException(id, JGitText.get().corruptObjectInvalidType);
589 				offset.value = position + 7;
590 				return Constants.OBJ_COMMIT;
591 
592 			case 't':
593 				switch (typeString[position + 1]) {
594 				case 'a':
595 					if (typeString[position + 2] != 'g'
596 							|| typeString[position + 3] != endMark)
597 						throw new CorruptObjectException(id, JGitText.get().corruptObjectInvalidType);
598 					offset.value = position + 4;
599 					return Constants.OBJ_TAG;
600 
601 				case 'r':
602 					if (typeString[position + 2] != 'e'
603 							|| typeString[position + 3] != 'e'
604 							|| typeString[position + 4] != endMark)
605 						throw new CorruptObjectException(id, JGitText.get().corruptObjectInvalidType);
606 					offset.value = position + 5;
607 					return Constants.OBJ_TREE;
608 
609 				default:
610 					throw new CorruptObjectException(id, JGitText.get().corruptObjectInvalidType);
611 				}
612 
613 			default:
614 				throw new CorruptObjectException(id, JGitText.get().corruptObjectInvalidType);
615 			}
616 		} catch (ArrayIndexOutOfBoundsException bad) {
617 			CorruptObjectException coe = new CorruptObjectException(id,
618 					JGitText.get().corruptObjectInvalidType);
619 			coe.initCause(bad);
620 			throw coe;
621 		}
622 	}
623 
624 	/**
625 	 * Convert an integer into its decimal representation.
626 	 *
627 	 * @param s
628 	 *            the integer to convert.
629 	 * @return a decimal representation of the input integer. The returned array
630 	 *         is the smallest array that will hold the value.
631 	 */
632 	public static byte[] encodeASCII(long s) {
633 		return encodeASCII(Long.toString(s));
634 	}
635 
636 	/**
637 	 * Convert a string to US-ASCII encoding.
638 	 *
639 	 * @param s
640 	 *            the string to convert. Must not contain any characters over
641 	 *            127 (outside of 7-bit ASCII).
642 	 * @return a byte array of the same length as the input string, holding the
643 	 *         same characters, in the same order.
644 	 * @throws java.lang.IllegalArgumentException
645 	 *             the input string contains one or more characters outside of
646 	 *             the 7-bit ASCII character space.
647 	 */
648 	public static byte[] encodeASCII(String s) {
649 		final byte[] r = new byte[s.length()];
650 		for (int k = r.length - 1; k >= 0; k--) {
651 			final char c = s.charAt(k);
652 			if (c > 127)
653 				throw new IllegalArgumentException(MessageFormat.format(JGitText.get().notASCIIString, s));
654 			r[k] = (byte) c;
655 		}
656 		return r;
657 	}
658 
659 	/**
660 	 * Convert a string to a byte array in the standard character encoding.
661 	 *
662 	 * @param str
663 	 *            the string to convert. May contain any Unicode characters.
664 	 * @return a byte array representing the requested string, encoded using the
665 	 *         default character encoding (UTF-8).
666 	 * @see #CHARACTER_ENCODING
667 	 */
668 	public static byte[] encode(String str) {
669 		final ByteBuffer bb = UTF_8.encode(str);
670 		final int len = bb.limit();
671 		if (bb.hasArray() && bb.arrayOffset() == 0) {
672 			final byte[] arr = bb.array();
673 			if (arr.length == len)
674 				return arr;
675 		}
676 
677 		final byte[] arr = new byte[len];
678 		bb.get(arr);
679 		return arr;
680 	}
681 
682 	static {
683 		if (OBJECT_ID_LENGTH != newMessageDigest().getDigestLength())
684 			throw new LinkageError(JGitText.get().incorrectOBJECT_ID_LENGTH);
685 		CHARSET = UTF_8;
686 		CHARACTER_ENCODING = UTF_8.name();
687 	}
688 
689 	/** name of the file containing the commit msg for a merge commit */
690 	public static final String MERGE_MSG = "MERGE_MSG";
691 
692 	/** name of the file containing the IDs of the parents of a merge commit */
693 	public static final String MERGE_HEAD = "MERGE_HEAD";
694 
695 	/** name of the file containing the ID of a cherry pick commit in case of conflicts */
696 	public static final String CHERRY_PICK_HEAD = "CHERRY_PICK_HEAD";
697 
698 	/** name of the file containing the commit msg for a squash commit */
699 	public static final String SQUASH_MSG = "SQUASH_MSG";
700 
701 	/** name of the file containing the ID of a revert commit in case of conflicts */
702 	public static final String REVERT_HEAD = "REVERT_HEAD";
703 
704 	/**
705 	 * name of the ref ORIG_HEAD used by certain commands to store the original
706 	 * value of HEAD
707 	 */
708 	public static final String ORIG_HEAD = "ORIG_HEAD";
709 
710 	/**
711 	 * Name of the file in which git commands and hooks store and read the
712 	 * message prepared for the upcoming commit.
713 	 *
714 	 * @since 4.0
715 	 */
716 	public static final String COMMIT_EDITMSG = "COMMIT_EDITMSG";
717 
718 	/**
719 	 * Well-known object ID for the empty blob.
720 	 *
721 	 * @since 0.9.1
722 	 */
723 	public static final ObjectId/../org/eclipse/jgit/lib/ObjectId.html#ObjectId">ObjectId EMPTY_BLOB_ID = ObjectId
724 			.fromString("e69de29bb2d1d6434b8b29ae775ad8c2e48c5391");
725 
726 	/**
727 	 * Well-known object ID for the empty tree.
728 	 *
729 	 * @since 5.1
730 	 */
731 	public static final ObjectId/../org/eclipse/jgit/lib/ObjectId.html#ObjectId">ObjectId EMPTY_TREE_ID = ObjectId
732 			.fromString("4b825dc642cb6eb9a060e54bf8d69288fbee4904");
733 
734 	/**
735 	 * Suffix of lock file name
736 	 *
737 	 * @since 4.7
738 	 */
739 	public static final String LOCK_SUFFIX = ".lock"; //$NON-NLS-1$
740 
741 	private Constants() {
742 		// Hide the default constructor
743 	}
744 }