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 	 * Name of the attributes file
390 	 *
391 	 * @since 3.7
392 	 */
393 	public static final String DOT_GIT_ATTRIBUTES = ".gitattributes";
394 
395 	/**
396 	 * Key for filters in .gitattributes
397 	 *
398 	 * @since 4.2
399 	 */
400 	public static final String ATTR_FILTER = "filter";
401 
402 	/**
403 	 * clean command name, used to call filter driver
404 	 *
405 	 * @since 4.2
406 	 */
407 	public static final String ATTR_FILTER_TYPE_CLEAN = "clean";
408 
409 	/**
410 	 * smudge command name, used to call filter driver
411 	 *
412 	 * @since 4.2
413 	 */
414 	public static final String ATTR_FILTER_TYPE_SMUDGE = "smudge";
415 
416 	/**
417 	 * Builtin filter commands start with this prefix
418 	 *
419 	 * @since 4.6
420 	 */
421 	public static final String BUILTIN_FILTER_PREFIX = "jgit://builtin/";
422 
423 	/** Name of the ignore file */
424 	public static final String DOT_GIT_IGNORE = ".gitignore";
425 
426 	/** Name of the submodules file */
427 	public static final String DOT_GIT_MODULES = ".gitmodules";
428 
429 	/** Name of the .git/shallow file */
430 	public static final String SHALLOW = "shallow";
431 
432 	/**
433 	 * Prefix of the first line in a ".git" file
434 	 *
435 	 * @since 3.6
436 	 */
437 	public static final String GITDIR = "gitdir: ";
438 
439 	/**
440 	 * Name of the folder (inside gitDir) where submodules are stored
441 	 *
442 	 * @since 3.6
443 	 */
444 	public static final String MODULES = "modules";
445 
446 	/**
447 	 * Name of the folder (inside gitDir) where the hooks are stored.
448 	 *
449 	 * @since 3.7
450 	 */
451 	public static final String HOOKS = "hooks";
452 
453 	/**
454 	 * Merge attribute.
455 	 *
456 	 * @since 4.9
457 	 */
458 	public static final String ATTR_MERGE = "merge"; //$NON-NLS-1$
459 
460 	/**
461 	 * Diff attribute.
462 	 *
463 	 * @since 4.11
464 	 */
465 	public static final String ATTR_DIFF = "diff"; //$NON-NLS-1$
466 
467 	/**
468 	 * Binary value for custom merger.
469 	 *
470 	 * @since 4.9
471 	 */
472 	public static final String ATTR_BUILTIN_BINARY_MERGER = "binary"; //$NON-NLS-1$
473 
474 	/**
475 	 * Create a new digest function for objects.
476 	 *
477 	 * @return a new digest object.
478 	 * @throws java.lang.RuntimeException
479 	 *             this Java virtual machine does not support the required hash
480 	 *             function. Very unlikely given that JGit uses a hash function
481 	 *             that is in the Java reference specification.
482 	 */
483 	public static MessageDigest newMessageDigest() {
484 		try {
485 			return MessageDigest.getInstance(HASH_FUNCTION);
486 		} catch (NoSuchAlgorithmException nsae) {
487 			throw new RuntimeException(MessageFormat.format(
488 					JGitText.get().requiredHashFunctionNotAvailable, HASH_FUNCTION), nsae);
489 		}
490 	}
491 
492 	/**
493 	 * Convert an OBJ_* type constant to a TYPE_* type constant.
494 	 *
495 	 * @param typeCode the type code, from a pack representation.
496 	 * @return the canonical string name of this type.
497 	 */
498 	public static String typeString(int typeCode) {
499 		switch (typeCode) {
500 		case OBJ_COMMIT:
501 			return TYPE_COMMIT;
502 		case OBJ_TREE:
503 			return TYPE_TREE;
504 		case OBJ_BLOB:
505 			return TYPE_BLOB;
506 		case OBJ_TAG:
507 			return TYPE_TAG;
508 		default:
509 			throw new IllegalArgumentException(MessageFormat.format(
510 					JGitText.get().badObjectType, Integer.valueOf(typeCode)));
511 		}
512 	}
513 
514 	/**
515 	 * Convert an OBJ_* type constant to an ASCII encoded string constant.
516 	 * <p>
517 	 * The ASCII encoded string is often the canonical representation of
518 	 * the type within a loose object header, or within a tag header.
519 	 *
520 	 * @param typeCode the type code, from a pack representation.
521 	 * @return the canonical ASCII encoded name of this type.
522 	 */
523 	public static byte[] encodedTypeString(int typeCode) {
524 		switch (typeCode) {
525 		case OBJ_COMMIT:
526 			return ENCODED_TYPE_COMMIT;
527 		case OBJ_TREE:
528 			return ENCODED_TYPE_TREE;
529 		case OBJ_BLOB:
530 			return ENCODED_TYPE_BLOB;
531 		case OBJ_TAG:
532 			return ENCODED_TYPE_TAG;
533 		default:
534 			throw new IllegalArgumentException(MessageFormat.format(
535 					JGitText.get().badObjectType, Integer.valueOf(typeCode)));
536 		}
537 	}
538 
539 	/**
540 	 * Parse an encoded type string into a type constant.
541 	 *
542 	 * @param id
543 	 *            object id this type string came from; may be null if that is
544 	 *            not known at the time the parse is occurring.
545 	 * @param typeString
546 	 *            string version of the type code.
547 	 * @param endMark
548 	 *            character immediately following the type string. Usually ' '
549 	 *            (space) or '\n' (line feed).
550 	 * @param offset
551 	 *            position within <code>typeString</code> where the parse
552 	 *            should start. Updated with the new position (just past
553 	 *            <code>endMark</code> when the parse is successful.
554 	 * @return a type code constant (one of {@link #OBJ_BLOB},
555 	 *         {@link #OBJ_COMMIT}, {@link #OBJ_TAG}, {@link #OBJ_TREE}.
556 	 * @throws org.eclipse.jgit.errors.CorruptObjectException
557 	 *             there is no valid type identified by <code>typeString</code>.
558 	 */
559 	public static int decodeTypeString(final AnyObjectId id,
560 			final byte[] typeString, final byte endMark,
561 			final MutableInteger offset) throws CorruptObjectException {
562 		try {
563 			int position = offset.value;
564 			switch (typeString[position]) {
565 			case 'b':
566 				if (typeString[position + 1] != 'l'
567 						|| typeString[position + 2] != 'o'
568 						|| typeString[position + 3] != 'b'
569 						|| typeString[position + 4] != endMark)
570 					throw new CorruptObjectException(id, JGitText.get().corruptObjectInvalidType);
571 				offset.value = position + 5;
572 				return Constants.OBJ_BLOB;
573 
574 			case 'c':
575 				if (typeString[position + 1] != 'o'
576 						|| typeString[position + 2] != 'm'
577 						|| typeString[position + 3] != 'm'
578 						|| typeString[position + 4] != 'i'
579 						|| typeString[position + 5] != 't'
580 						|| typeString[position + 6] != endMark)
581 					throw new CorruptObjectException(id, JGitText.get().corruptObjectInvalidType);
582 				offset.value = position + 7;
583 				return Constants.OBJ_COMMIT;
584 
585 			case 't':
586 				switch (typeString[position + 1]) {
587 				case 'a':
588 					if (typeString[position + 2] != 'g'
589 							|| typeString[position + 3] != endMark)
590 						throw new CorruptObjectException(id, JGitText.get().corruptObjectInvalidType);
591 					offset.value = position + 4;
592 					return Constants.OBJ_TAG;
593 
594 				case 'r':
595 					if (typeString[position + 2] != 'e'
596 							|| typeString[position + 3] != 'e'
597 							|| typeString[position + 4] != endMark)
598 						throw new CorruptObjectException(id, JGitText.get().corruptObjectInvalidType);
599 					offset.value = position + 5;
600 					return Constants.OBJ_TREE;
601 
602 				default:
603 					throw new CorruptObjectException(id, JGitText.get().corruptObjectInvalidType);
604 				}
605 
606 			default:
607 				throw new CorruptObjectException(id, JGitText.get().corruptObjectInvalidType);
608 			}
609 		} catch (ArrayIndexOutOfBoundsException bad) {
610 			CorruptObjectException coe = new CorruptObjectException(id,
611 					JGitText.get().corruptObjectInvalidType);
612 			coe.initCause(bad);
613 			throw coe;
614 		}
615 	}
616 
617 	/**
618 	 * Convert an integer into its decimal representation.
619 	 *
620 	 * @param s
621 	 *            the integer to convert.
622 	 * @return a decimal representation of the input integer. The returned array
623 	 *         is the smallest array that will hold the value.
624 	 */
625 	public static byte[] encodeASCII(long s) {
626 		return encodeASCII(Long.toString(s));
627 	}
628 
629 	/**
630 	 * Convert a string to US-ASCII encoding.
631 	 *
632 	 * @param s
633 	 *            the string to convert. Must not contain any characters over
634 	 *            127 (outside of 7-bit ASCII).
635 	 * @return a byte array of the same length as the input string, holding the
636 	 *         same characters, in the same order.
637 	 * @throws java.lang.IllegalArgumentException
638 	 *             the input string contains one or more characters outside of
639 	 *             the 7-bit ASCII character space.
640 	 */
641 	public static byte[] encodeASCII(String s) {
642 		final byte[] r = new byte[s.length()];
643 		for (int k = r.length - 1; k >= 0; k--) {
644 			final char c = s.charAt(k);
645 			if (c > 127)
646 				throw new IllegalArgumentException(MessageFormat.format(JGitText.get().notASCIIString, s));
647 			r[k] = (byte) c;
648 		}
649 		return r;
650 	}
651 
652 	/**
653 	 * Convert a string to a byte array in the standard character encoding.
654 	 *
655 	 * @param str
656 	 *            the string to convert. May contain any Unicode characters.
657 	 * @return a byte array representing the requested string, encoded using the
658 	 *         default character encoding (UTF-8).
659 	 * @see #CHARACTER_ENCODING
660 	 */
661 	public static byte[] encode(String str) {
662 		final ByteBuffer bb = UTF_8.encode(str);
663 		final int len = bb.limit();
664 		if (bb.hasArray() && bb.arrayOffset() == 0) {
665 			final byte[] arr = bb.array();
666 			if (arr.length == len)
667 				return arr;
668 		}
669 
670 		final byte[] arr = new byte[len];
671 		bb.get(arr);
672 		return arr;
673 	}
674 
675 	static {
676 		if (OBJECT_ID_LENGTH != newMessageDigest().getDigestLength())
677 			throw new LinkageError(JGitText.get().incorrectOBJECT_ID_LENGTH);
678 		CHARSET = UTF_8;
679 		CHARACTER_ENCODING = UTF_8.name();
680 	}
681 
682 	/** name of the file containing the commit msg for a merge commit */
683 	public static final String MERGE_MSG = "MERGE_MSG";
684 
685 	/** name of the file containing the IDs of the parents of a merge commit */
686 	public static final String MERGE_HEAD = "MERGE_HEAD";
687 
688 	/** name of the file containing the ID of a cherry pick commit in case of conflicts */
689 	public static final String CHERRY_PICK_HEAD = "CHERRY_PICK_HEAD";
690 
691 	/** name of the file containing the commit msg for a squash commit */
692 	public static final String SQUASH_MSG = "SQUASH_MSG";
693 
694 	/** name of the file containing the ID of a revert commit in case of conflicts */
695 	public static final String REVERT_HEAD = "REVERT_HEAD";
696 
697 	/**
698 	 * name of the ref ORIG_HEAD used by certain commands to store the original
699 	 * value of HEAD
700 	 */
701 	public static final String ORIG_HEAD = "ORIG_HEAD";
702 
703 	/**
704 	 * Name of the file in which git commands and hooks store and read the
705 	 * message prepared for the upcoming commit.
706 	 *
707 	 * @since 4.0
708 	 */
709 	public static final String COMMIT_EDITMSG = "COMMIT_EDITMSG";
710 
711 	/**
712 	 * Well-known object ID for the empty blob.
713 	 *
714 	 * @since 0.9.1
715 	 */
716 	public static final ObjectId/../org/eclipse/jgit/lib/ObjectId.html#ObjectId">ObjectId EMPTY_BLOB_ID = ObjectId
717 			.fromString("e69de29bb2d1d6434b8b29ae775ad8c2e48c5391");
718 
719 	/**
720 	 * Well-known object ID for the empty tree.
721 	 *
722 	 * @since 5.1
723 	 */
724 	public static final ObjectId/../org/eclipse/jgit/lib/ObjectId.html#ObjectId">ObjectId EMPTY_TREE_ID = ObjectId
725 			.fromString("4b825dc642cb6eb9a060e54bf8d69288fbee4904");
726 
727 	/**
728 	 * Suffix of lock file name
729 	 *
730 	 * @since 4.7
731 	 */
732 	public static final String LOCK_SUFFIX = ".lock"; //$NON-NLS-1$
733 
734 	private Constants() {
735 		// Hide the default constructor
736 	}
737 }